sort

Dave Jones djones at megatest.UUCP
Fri Jun 30 10:47:09 AEST 1989


In article <4700040 at m.cs.uiuc.edu> kenny at m.cs.uiuc.edu writes:
>>Does anyone have a sort routine (in memory sort> faster than quicksort, of
>>so please e-mail it to me, thanks.
>
>Generally speaking, there isn't any; at least, no sort can be faster
>than quicksort by more than a constant factor on a von Neumann machine.  


Where'd you come up with that? If you can spare the memory for it, a bucket sort,
with a bucket for each key, is O(n), not O(n-log-n). You can make trade-offs
between speed and memory usage with mixed methods. Besides, there are considerations
of average-case vs. worst-case. The relative costs of internal and external
memory access and key comparison also matters.

The subject of sorting has been (ahem) hashed over perhaps as much as any
other in the field of computers. Why not "open book before engaging mouth"? :-)



More information about the Comp.lang.c mailing list