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/22
Date: 1997-04-22T00:00:00+00:00	[thread overview]
Message-ID: <dewar.861719085@merv> (raw)
In-Reply-To: 1997Apr20.234419.16075@ocsystems.com


Joel says

<<I would be inclined to go with a merge sort (of some kind or other).
Allow me to quote from Robert Sedgewick's _Algorithms_ (I highly
recommend this book).  "Mergesort is the method of choice for sorting
a linked list, where sequential access is the only kind of access
available."  It is quite simple, has O(NlogN) worst-case performance and
in your situation ought to require additional memory of at most 1 array
of strings (plus a teensy bit).  Of course sort each array by any method
you prefer (quicksort, heapsort, shellsort, or selection sort).>>

That seems a kind of confused mixture. If you are going to use merge sort,
use merge sort. you don't need any arrays, and you don't need to use any
other algorithm. The algorithm is trivial, split the list into two halves,
sort each half recursively, and then do a merge, end of story. This has
worst case NlogN and is what Sedgewick means when he makes his suggestion.





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