Abstract
A fine analysis is given of the transitional behavior of the average cost of quicksort with median-of-three. Asymptotic formulae are derived for the stepwise improvement of the average cost of quicksort when iterating median-of-threek rounds for all possible values ofk. The methods used are general enough to apply to quicksort with median-of-(2t + 1) and to explain in a precise manner the transitional behaviors of the average cost from insertion sort to quicksort proper. Our results also imply nontrivial bounds on the expected height, “saturation level,” and width in a random locally balanced binary search tree.
Similar content being viewed by others
References
N. Bleistein and R. A. Handelsman,Asymptotic Expansions of Integrals, Dover, New York, 1985.
H. E. Daniels, Tail probability approximations,International Statistical Review,55, 37–48.
L. Devroye, On the expected height of fringe-balanced trees,Acta Informatica,30, 459–466, 1993.
P. Flajolet and A. M. Odlyzko, Singularity analysis of generating function,SIAM Journal on Discrete Mathematics,3, 216–240, 1990.
G. H. Gonnet and R. Baeza-Yates,Handbook of Algorithms and Data Structures, second edition, Addison-Wesley, Reading, Massachusetts, 1991.
D. H. Greene, Labelled formal languages and their uses, Ph.D. Thesis, Stanford University, 1983.
L. J. Guibas, A principle of independence for binary tree searching,Acta Informatica,4, 293–298, 1975.
P. Hennequin, Combinatorial analysis of quicksort algorithm,RAIRO Informatique théorique et Applications,23, 317–333, 1989.
P. Hennequin, Analyse en moyenne d’algorithmes, tri rapide et arbres de recherche, Ph.D. Thesis, Ecole Polytechnique, 1991.
C. A. R. Hoare, Quicksort,Computer Journal,5, 10–15, 1962.
H.-K. Hwang, A Possion * negative binomial convolution law for random polynomials over finite fields,Random Structures and Algorithms,13, 17–47, 1998.
H.-K. Hwang, Sur la répartition des valeurs des fonctions arithmétiques: le nombre de facteurs premiers d’un entier,Journal of Number Theory,69, 135–152, 1998.
H.-K. Hwang, B.-Y. Yang, and Y.-N. Yeh, Presorting algorithms: an average-case point of view,Theoretical Computer Science,242, 29–40, 2000.
E. L. Ince,Ordinary Differential Equations, Dover, New York, 1926.
D. E. Knuth,The Art of Computer Programming, Volume III: Sorting and Searching, second edition, Addison-Wesley, Reading, Massachusetts, 1998.
Ľ. Kollár, Optimal sorting of seven element sets,Mathematical Foundations of Computer Science (Bratislave, 1986), Lecture Notes in Computer Science, Vol. 233, No. 449–457, Springer-Verlag, Berlin, 1986.
R. Lugannani and S. O. Rice, Saddlepoint approximation for the distribution of the sum of independent random variables,Advances in Applied Probability,12, 475–490, 1980.
H. M. Mahmoud,Evolution of Random Search Trees, Wiley, New York, 1992.
C. Martínez, A. Panholzer, and H. Prodinger, On the number of descendants and ascendants in random search trees,Electronic Journal on Combinatorics,5, # R20, 1998.
C. Martínez and S. Roura, Optimal sampling strategies in quicksort,Automata, Languages, and Programming (Aalborg, 1998). Lecture Notes in Computer Science, Vol. 1443, pp. 327–338, Springer-Verlag, Berlin, 1998.
C. C. McGeoch and J. D. Tygar, Optimal sampling strategies for Quicksort,Random Structures and Algorithms,7, 287–300, 1995.
A. M. Odlyzko and H. S. Wilf, Bandwidths and profiles of trees,Journal of Combinatorial Theory, Series B,42, 348–370, 1987.
P. V. Poblete and J. I. Munro, The analysis of a fringe heuristic for binary search trees,Journal of Algorithms,6, 336–350, 1985.
R. Sedgewick, The analysis of Quicksort programs,Acta Informatica,7, 327–355, 1977.
R. Sedgewick,Quicksort, Garland, New York, 1978.
R. Sedgewick,Algorithms in C, third edition, Addison-Wesley, Reading, Massachusetts, 1997.
R. Sedgewick and P. Flajolet,An Introduction to the Analysis of Algorithms, Addison-Wesley, Reading, Massachusetts, 1996.
A. Walker and D. Wood, Locally balanced binary search trees,Computer Journal,19, 322–325, 1976.
R. Wong,Asymptotic Approximations of Integrals, Academic Press, Boston, 1989.
Author information
Authors and Affiliations
Additional information
Communicated by H. Prodinger and W. Szpankowski.
This work was done while the first author was at the Institute of Mathematics, Academia Sinica, Taipei, Taiwan.
Online publication September 22, 2000.
Rights and permissions
About this article
Cite this article
Chern, H.H., Hwang, H.K. Transitional behaviors of the average cost of quicksort with median-of-(2t + 1). Algorithmica 29, 44–69 (2001). https://doi.org/10.1007/BF02679613
Received:
Revised:
Issue Date:
DOI: https://doi.org/10.1007/BF02679613