comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthewjheaney@earthlink.net>
Subject: Re: sorting large numbers of large records
Date: Mon, 28 Jul 2003 23:33:21 GMT
Date: 2003-07-28T23:33:21+00:00	[thread overview]
Message-ID: <5piVa.1736$Bg.946@newsread4.news.pas.earthlink.net> (raw)
In-Reply-To: bg3fgg$qig$1@grapevine.wam.umd.edu


"Brien L. Christesen" <blchrist@rac2.wam.umd.edu> wrote in message
news:bg3fgg$qig$1@grapevine.wam.umd.edu...
>
> Does anyone know of a good way to do this kind of sort?  Thanks in advance
> for any responses.

The list containers in the Charles library have a (quick)sort operation.
You could read the records into a singly-linked list container, and then
sort that.  Lists allow the sort to be done without copying elements, by
exchanging pointers.

Alternatively, you could use a vector or array, and then use the generic
sort algorithm (also part of the library) to sort that.  A vector is more
space efficient, but a sort requires copying of elements.

Another option is to read the records into a set, which automatically sorts
elements as they are inserted into the container.  (Sets and maps are
implemented using a balanced tree.)

A set is probably overkill, though, because you don't need do lookups or
anything.  If all you want to do is sort, then try using a list.

The Charles library is available from my website.

http://home.earthlink.net/~matthewjheaney/charles/

Look for a new release of Charles in the next few days.  I am currently
synchronizing the interfaces of the hashed vs. sorted associative
containers.

Send me email if you have any specific library questions.

-Matt





  parent reply	other threads:[~2003-07-28 23:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-28 15:29 sorting large numbers of large records Brien L. Christesen
2003-07-28 15:35 ` Vinzent Hoefler
2003-07-31 15:22   ` Brien L. Christesen
2003-07-28 16:25 ` Hyman Rosen
2003-07-28 20:30 ` John R. Strohm
2003-07-28 20:52   ` Hyman Rosen
2003-07-28 23:47     ` Matthew Heaney
2003-07-28 23:33 ` Matthew Heaney [this message]
2003-07-28 23:43 ` Matthew Heaney
2003-07-29  0:42 ` John Cupak
2003-07-29  3:38   ` Matthew Heaney
2003-07-29  8:32   ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
2003-07-29 13:10 Brien L. Christesen
2003-07-29 14:30 ` Larry Kilgallen
2003-07-30  0:32 ` Keith Thompson
2003-07-30  1:53   ` Hyman Rosen
2003-07-30 14:55     ` Matthew Heaney
2003-07-30 16:41       ` Chad R. Meiners
replies disabled

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