Summary
The Quicksort sorting algorithm and its best variants are presented and analyzed. Results are derived which make it possible to obtain exact formulas describing the total expected running time of particular implementations on real computers of Quicksort and an improvement called the median-of-three modification. Detailed analysis of the effect of an implementation technique called loop unwrapping is presented. The paper is intended not only to present results of direct practical utility, but also to illustrate the intriguing mathematics which arises in the complete analysis of this important algorithm.
Similar content being viewed by others
References
Abramowitz, M., Stegun, I. A.: Handbook of mathematical functions. New York: Dover Publications 1970
Aho, A. V., Hopcroft, J. E., Ullman, J. D.: The design and analysis of computer algorithms. Reading (Mass.): Addison-Wesley 1974
Boothroyd, J.: Sort of a section of the elements of an array by determining the rank of each element (Algorithm 25); Ordering the subscripts of an array section according to the magnitudes of the elements (Algorithm 26). Computer J. 10, pp308–310. [See also notes by R. S. Scowen in Computer J. 12, 408–409 (1969) and by A. D. Woodall in Computer J. 13 (1970)]
Brawn, B. S., Gustavson, F. G., Mankin, E.: Sorting in a paging environment. Comm. ACM 13, 483–494 (1970)
Cocke, J., Schwartz, J. T.: Programming languages and their compilers. Preliminary notes. Courant Inst, of Math. Sciences, New York University (1970)
Frazer, W. D., McKellar, A. C.: Samplesort: a sampling approach to minimal storage tree sorting. J. ACM 17, 496–507 (1970)
Hoare, C. A. R.: Partition (Algorithm 63); Quicksort (Algorithm 64); Find (Algorithm 65). Comm. ACM 4, 321–322 (1961). [See also certification by J. S. Hillmore in Comm. ACM 5, 439 (1962) and by B. Randell and L. J. Russell in Comm. ACM 6, 446 (1963)]
Hoare, C. A. R.: Quicksort. Computer J. 5, 10–15 (1962)
Knuth, D. E.: The art of computer programming 1: Fundamental algorithms. Reading (Mass.): Addison-Wesley 1968
Knuth, D. E.: The art of computer programming 2: Seminumerical algorithms. Reading (Mass.): Addison-Wesley 1969
Knuth, D. E.: The art of computer programming 3: Sorting and searching. Reading (Mass.): Addison-Wesley 1972
Knuth, D. E.: Structured programming with go to statements. Computing Surveys 6, 261–301 (1974)
Loeser, R.: Some performance tests of “quicksort” and descendants. Comm. ACM 17, 143–152 (1974)
Morris, R.: Some theorems on sorting. SIAM J. Appl. Math. 17, 1–6 (1969)
Rich, R. P.: Internal sorting methods illustrated with PL/I programs. Englewood Cliffs (N.J.): Prentice-Hall 1972
Scowen, R. S.: Quickersort (Algorithm 271). Comm. ACM 8, 669–670 (1965). (See also certification by C. R. Blair in Comm. ACM 9, 354 (1966))
Sedgewick, R.: Quicksort. Stanford University, Stanford Computer Science Report STAN-CS-75-492, Ph. D. Thesis, May 1975
Sedgewick, R.: Quicksort with equal keys. SIAM J. Computing (to appear)
Sedgewick, R.: Implementing Quicksort programs (to appear)
Singleton, R. C.: An efficient algorithm for sorting with minimal storage (Algorithm 347). Comm. ACM 12, 185–187 (1969). [See also remarks by R. Griffin and K. A. Redish in Comm. ACM 13, 54 (1970) and by R. Peto in Comm. ACM 13, 624 (1970)]
van Emden, M. N.: Increasing the efficiency of quicksort (Algorithm 402). Comm. ACM 13, 693–694 (1970). [See also the article by the same name in Comm. ACM 13, 563–567 (1970)]
Wirth, N.: Algorithms + Data Structures = Programs. Englewood Cliffs (N. J.): Prentice-Hall 1976
Author information
Authors and Affiliations
Additional information
This work was supported in part by the Fannie and John Hertz Foundation, and in part by the National Science Foundation Grants No. GJ-28074 and MC S75-23738
Rights and permissions
About this article
Cite this article
Sedgewick, R. The analysis of Quicksort programs. Acta Informatica 7, 327–355 (1977). https://doi.org/10.1007/BF00289467
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00289467