comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Anyone help develop an algorythm?
Date: 1997/04/23
Date: 1997-04-23T00:00:00+00:00	[thread overview]
Message-ID: <E93Eq2.1H6.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 5jjtaj$1e9e@newssvr01-int.news.prodigy.com


Matthew Givens (NKSW39B@prodigy.com) wrote:
: stt@houdini.camb.inmet.com (Tucker Taft) wrote:
: >
: >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?

"The Handbook of Algorithms and Data Structures in Pascal and C"
Second Edition, G.H. Gonnet, R. Baeza-Yates, Addison-Wesley,
look for "Quick Sort on Lists" in the table of contents.

You can also derive the algorithm yourself if you understand
how "normal" Quick Sort works.

For your case of a list of arrays, I suspect you could create a hybrid
of "normal" Quick Sort and a linked-list version.  The requirements
of Quick Sort are an ability to iterate though any partition of an
array, and to make exchanges.  If your iteration "cursor" consists of a 
pointer to the "current" array, and an index into the current array, and 
a partition were represented by two such cursors, then I believe you
could use the basic Quick Sort algorithm relatively straightforwardly.

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




  parent 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 ` Tucker Taft
1997-04-20  0:00 ` Tom Moran
1997-04-22  0:00   ` Michael F Brenner
1997-04-20  0:00 ` Robert A Duff
1997-04-22  0:00   ` Steve Doiel
1997-04-20  0:00 ` Joel VanLaven
1997-04-22  0:00   ` Robert Dewar
1997-04-20  0:00 ` Robert Dewar
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Robert Dewar
     [not found] ` <e8yijs.fg1.0.-s@inmet.camb.inmet.com>
1997-04-23  0:00   ` Matthew Givens
1997-04-23  0:00     ` Robert Dewar
1997-04-28  0:00       ` Matthew Givens
1997-04-23  0:00     ` Tucker Taft [this message]
     [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