comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Anyone help develop an algorythm?
Date: 1997/04/23
Date: 1997-04-23T00:00:00+00:00	[thread overview]
Message-ID: <dewar.861852750@merv> (raw)
In-Reply-To: 5jjtaj$1e9e@newssvr01-int.news.prodigy.com


<<>There is a variant of quick-sort that works on linked lists.
>The trick is to use the first element in the list as the "pivot" and
>then build up two new linked lists containing the left and right
partitions,
>and then recurse as usual.  I would think this could be generalized
>to handle a linked list of arrays (left as an exercise to the reader ;-).


Could you give me a reference (or two) where I might be able to find the
Quick Sort variation you mentioned?
>>


This is not quick sort at all. The essence of quick sort is the in place
exchange -- otherwise you are just talking about a simple recursive
sort, known for a long time before quicksort was published by Hoare.

The algorithm is trivial enough, just form two lists one of elements
greater than the pivot, one of elements less than the pivot, and then
recursively sort both lists and append one to the other.

However, this algorithm is NEVER preferable to a straight 2-way merge
sort, since its average behavior is the same, and its worst case performance
is quadratic.

The only reasonable way to sort a list is with a two way merge sort. 
Divide the list into equal parts, sort each sublist recurs9ively, and
then do a 2-way merge to form the result. This sort is average and
worst case NlogN, is easy to program, and has no disadvatanges over
other methods that I can see.





  reply	other threads:[~1997-04-23  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-20  0:00 Anyone help develop an algorythm? Matthew Givens
1997-04-20  0:00 ` Robert A Duff
1997-04-22  0:00   ` Steve Doiel
1997-04-20  0:00 ` Robert Dewar
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Robert Dewar
1997-04-20  0:00 ` Joel VanLaven
1997-04-22  0:00   ` Robert Dewar
1997-04-20  0:00 ` Tucker Taft
1997-04-20  0:00 ` Tom Moran
1997-04-22  0:00   ` Michael F Brenner
     [not found] ` <e8yijs.fg1.0.-s@inmet.camb.inmet.com>
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Robert Dewar [this message]
1997-04-28  0:00       ` Matthew Givens
1997-04-23  0:00     ` Tucker Taft
     [not found] ` <335af137.54d7@bix.com>
1997-04-28  0:00   ` Matthew Givens
1997-04-28  0:00     ` Robert Dewar
1997-04-29  0:00       ` Matthew Givens
  -- strict thread matches above, loose matches on Subject: below --
1997-04-24  0:00 Marin David Condic, 561.796.8997, M/S 731-93
1997-04-25  0:00 ` Michael F Brenner
1997-04-28  0:00   ` Matthew Givens
1997-04-28  0:00 ` Matthew Givens
replies disabled

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