comp.lang.ada
 help / color / mirror / Atom feed
From: "Ron" <ron@no.spam>
Subject: Re: Smart sorting algorithm ?
Date: Mon, 08 Jul 2002 17:36:42 GMT
Date: 2002-07-08T17:36:42+00:00	[thread overview]
Message-ID: <K4kW8.58947$1D2.26575705@twister.socal.rr.com> (raw)
In-Reply-To: 3D2221CD.3F619935@easystreet.com

First, I hope Wes has investigated non-comparison-based sorting...

Second, Wes never indicated the number of items to sort, but used small
values (18 and 36) as examples.  If you only want to sort a small number of
items, then the On-Line Encyclopedia of Integer Sequences
(http://www.research.att.com/~njas/sequences/index.html) may be of help:
To sort 18 items (referenced by sequence number):
A036604 lists the minimal number of comparisons needed to sort n elements,
but only goes up to n=12.
A003070 gives 53 for ceiling(log_2 n!) (the lower bound on number of
comparisons required for comparison-based sorting)
A001768 gives 54 comparisons for merge sort
A001855 gives 59 comparisons for sorting by binary insertion
A003071 gives 67 comparisons for sorting by list merging
A006282 gives 82 comparisons for Batcher's parallel sort (which can be
implemented via a sorting network)
Also, the best sorting network I'm aware of requires 79
comparison-exchanges.

Third, quicksort isn't very good for a small number of items because of its
worst-case performance and overhead, which is why most sorting algorithms
based upon quicksort us another sorting method once the sub-lists are small.

Good luck!


- Ron Zeno





  parent reply	other threads:[~2002-07-08 17:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 16:32 Smart sorting algorithm ? Wes Groleau
2002-07-02 17:00 ` achrist
2002-07-02 20:00   ` Wes Groleau
2002-07-02 21:57     ` achrist
2002-07-02 22:22       ` Wes Groleau
2002-07-02 22:57         ` achrist
2002-07-03 14:25           ` Wes Groleau
2002-07-08 17:36       ` Ron [this message]
2002-07-02 20:48   ` Florian Weimer
2002-07-02 17:21 ` Wilhelm Spickermann
2002-07-02 20:01   ` Wes Groleau
2002-07-02 20:22     ` Tarjei T. Jensen
2002-07-06 13:40       ` Robert Dewar
2002-07-02 18:57 ` Florian Weimer
2002-07-02 20:08   ` Wes Groleau
2002-07-08 21:54 ` Wes Groleau
2002-07-09  4:35   ` Robert Dewar
2002-07-09  7:51   ` tmoran
2002-07-09 14:48   ` Ron
2002-07-10 14:38     ` Wes Groleau
2002-07-10 18:08       ` tmoran
2002-07-10 22:14         ` Wes Groleau
2002-07-09 18:59   ` Ron
2002-07-11 14:40     ` Wes Groleau
2002-07-11 20:04       ` Robert Dewar
2002-07-15 19:37         ` Wes Groleau
2002-07-15 22:08           ` achrist
  -- strict thread matches above, loose matches on Subject: below --
2002-07-02 17:50 Gautier direct_replies_not_read
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox