Mime-Version:
1.0
Date:
Sun, 17 Dec 2000 09:41:24 -0600
Content-Type:
text/plain; charset="us-ascii"; format=flowed
|
My data structures textbook and Mike Feldman's both contain a wide variety
of generic sorting procedures that do exactly what you desire.
Ada Plus Data Structures: An Object Based Approach
Dale, Lilly, McCormick
Jones and Bartlett Publisher
ISBN: 0669416762
http://catalog.jbpub.com/detail.cfm?i=41676-2
John
At 10:59 PM 12/16/2000 -0500, Jesse Farmer wrote:
>Hi everyone.
>
>Maybe I just haven't looked hard enough, but in the few hours that I
>searched, I've been unable to find a good package of sorting
>routines. Does anyone know of such a package?
>Here is what I need to do: sort an array of a objects of a user defined
>type. Sort of an example of what I need to do is like this: I have an
>array as follows:
>
>A2
>A3
>A1
>A4
>B1
>B3
>B2
>
>And I need to sort it so it looks like:
>
>A1
>A2
>A3
>A4
>B1
>B2
>B3
>
>Note that each object really has the letter and number as seperate fields
>(ie. Object1.Letter Object1.Number ). Above are likely values for each
>object that I would encounter.
>
>Note that the A's and B's will all ready be in order (ie all A's before all
>B's) as a given, so I don't need to worry about that part. What I am
>wondering however, is what might be the best sorting algorithm to do
>this. Quite likely, the number of objects at a given time will be less
>than 20, which makes me wonder whether or not using QuickSort would be the
>best way to go. Overhead is a concern, but speed is definitely the main
>priority. One of the thing I wonder about, is should I have my program
>sort the whole array in one step, or have my code step thru each Letter
>Prefix. If I have it go thru and just do a Letter worth at a time, it will
>almost certainly always be under 20 things to sort per letter. Because of
>the small number of objects I would be sorting in this case, I'm also
>considering shell sort, or insertion sort.
>
>I'd be very interested in knowing what anyone thinks, and where I might
>find a very fast implementation of QuickSort at. Thanks.
>
>-Jesse Farmer
|
|
|