[net.lang.c] Sorting ANYTHING

rbj@icst-cmr (Root Boy Jim) (04/07/86)

The basic rule of thumb for sorts is this:

	If you can understand why it works, it's too slow.

Sorts are extremely mathematical and have been analyzed to death
by such highbrows as Knuth, who have not forgotten all the math they took.

If you're going to sort a small number of things, it doesn't really
matter what you use. If you're sorting lots of stuff, use a system
sort and save the maintainer the headache of reading *your* sort.

	(Root Boy) Jim Cottrell		<rbj@cmr>

bzs@bu-cs.UUCP (Barry Shein) (04/22/86)

>If you're going to sort a small number of things, it doesn't really
>matter what you use. If you're sorting lots of stuff, use a system
>sort and save the maintainer the headache of reading *your* sort.
>
>	(Root Boy) Jim Cottrell		<rbj@cmr>

Or, if your system doesn't have a sort (or a useable sort) go to the
library and find Quicker Sort in the ACM Collected Algorithms and copy
the Fortran and Publication Algol code and go re-do it in whatever
language you like, won't take long and it's short enough it requires
no deep understanding. I did this for a bunch of people in a Chem dept
who were using the VMS1.6 SORT command and saved them something like
98% of the time for sorting matrix elements (like from 30 minutes to
30 seconds or something like that) and became an instant hero...and I
stole the code! Use the terrain.

	-Barry Shein, Boston University