Quicksort by C. A. R. Hoare is a sorting algorithm in place. It has a worst-case running time that is O(N**2); its expected running time is O(N*lgN).
It is often the best practical choice for sorting because it is remarkably efficient on the average. The following table compares four sorting algorithms. The A. array includes the integers in the range 1 to Max=10,100,1000,40000.
For sorting in descending order, you need only change the red coloured statements
do I = I while A.I > X; end
do J = J by -1 while X > A.J; end
|
CONNECTIONS
Literature
Cormen T. H., Leiserson Ch. E., Rivest R. L. Introduction to Algorithms
The MIT Press, Cambridge, 1990
Sedgewick R. Algorithms
Addison-Wesley, Reading, Massachusetts, 1984
Wirth N. Algorithms and data structure
New Jersey, Prentice Hall, Inc., Engelwood Cliffs, 1986
Acknowledgement
I changed the test from Max=10 ... 40000 to Max=100 ... 99999. Thanks for idea go to Walter Pachl.
Note
This test ran in the Windows 2000 Professional environment on the computer with 132MB RAM and processor x86Family 6 Mode 6 Stepping 5.