comp.lang.ada
 help / color / mirror / Atom feed
From: steved@pacifier.com (Steve Doiel)
Subject: Re: Anyone help develop an algorythm?
Date: 1997/04/22
Date: 1997-04-22T00:00:00+00:00	[thread overview]
Message-ID: <5jhae2$l62$1@news.pacifier.com> (raw)
In-Reply-To: E8yGpJ.Dyu@world.std.com



In article <E8yGpJ.Dyu@world.std.com>, bobduff@world.std.com says...
>
>In article <5jddg7$uf0@newssvr01-int.news.prodigy.com>,
>Matthew Givens <NKSW39B@prodigy.com> wrote:
>>I have a linked list, each node corresponding to an array (contiguous in 
>>memory) of fixed length strings. ...
>
>Perhaps you should construct an array on the side, containing pointers
>to all the strings.  Then sort that, using your favorite (fast) sorting
>algorithm.
>
>Constructing the array can be done in linear time.  You can walk the
>list once to determine the size of the array.  Or perhaps your program
>already knows the size.  Or perhaps it knows some reasonable upper bound
>on the size.  Then walk the list again, putting pointers to each string
>in the array.  (The strings need to be "aliased".)  Then do the sort.
>
>- Bob

Agreed... but with two notes:

  1) Check out the PAL to see if you can use an "off the shelf" sort... the
     last thing you should have to do is implement a sort _again_
     (what ever happened to software re-use?).

  2) The strings do not necesarily need to be aliased if each element in
     your array contains a pointer to the array and in index to the element,
     although the aliased approach is likely to be more efficient.

Steve Doiel





  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 ` Robert A Duff
1997-04-22  0:00   ` Steve Doiel [this message]
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
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
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