sorting algorithms

Brad Brown bradb at cs.toronto.edu
Fri Nov 10 03:44:21 AEST 1989


gwyn at smoke.BRL.MIL (Doug Gwyn) writes:

>In article <2835 at phred.UUCP> stevel at phred.UUCP (Steve Leach) writes:
>>Sorry if this has been discussed befor, but how are the following 
>>sorting methods different?

>The standard answer to such questions about sorting techniques is:
>Read Donald Knuth's "The Art of Computer Programming, Vol. 3 --
>Sorting and Searching".

A more accessable work is Sedgwick's "Algorithms, 2nd ed.".  Knuth is
great if you want to know just about everything there is to know about
an algorithm, but the analysis can get a bit thick and the source
code is hard to read sometimes.  Sedgwick's book is less rigerous,
but the source is in Pascal and the style is much more conversational.

When you start to look at the differences between the algorithms,
look especially at the complexity (roughly the worst case time
it will take to run), the mean complexity, the performance on
partially sorted data (some sorts, like quicksort, can degenerate
badly if you give it partially sorted data), whether you can sort
in-place or on disk, whether you can sort a linked list or an array...

					(-:  Brad Brown  :-)
					bradb at ai.utoronto.ca



More information about the Comp.lang.c mailing list