Hostname: page-component-78c5997874-mlc7c Total loading time: 0 Render date: 2024-11-11T01:24:55.107Z Has data issue: false hasContentIssue false

Dual-Pivot Quicksort: Optimality, Analysis and Zeros of Associated Lattice Paths

Published online by Cambridge University Press:  14 August 2018

MARTIN AUMÜLLER
Affiliation:
IT University of Copenhagen, Rued Langgaards Vej 7, 2300 Copenhagen, Denmark (e-mail: maau@itu.dk)
MARTIN DIETZFELBINGER
Affiliation:
Fakultät für Informatik und Automatisierung, Technische Universität Ilmenau, Helmholtzplatz 5, 98693 Ilmenau, Germany (e-mail: martin.dietzfelbinger@tu-ilmenau.de)
CLEMENS HEUBERGER
Affiliation:
Institut für Mathematik, Alpen-Adria-Universität Klagenfurt, Universitätsstraße 65–67, 9020 Klagenfurt am Wörthersee, Austria (e-mail: clemens.heuberger@aau.at, math@danielkrenn.at, daniel.krenn@aau.at)
DANIEL KRENN
Affiliation:
Institut für Mathematik, Alpen-Adria-Universität Klagenfurt, Universitätsstraße 65–67, 9020 Klagenfurt am Wörthersee, Austria (e-mail: clemens.heuberger@aau.at, math@danielkrenn.at, daniel.krenn@aau.at)
HELMUT PRODINGER
Affiliation:
Department of Mathematical Sciences, Stellenbosch University, 7602 Stellenbosch, South Africa (e-mail: hproding@sun.ac.za)

Abstract

We present an average-case analysis of a variant of dual-pivot quicksort. We show that the algorithmic partitioning strategy used is optimal, that is, it minimizes the expected number of key comparisons. For the analysis, we calculate the expected number of comparisons exactly as well as asymptotically; in particular, we provide exact expressions for the linear, logarithmic and constant terms.

An essential step is the analysis of zeros of lattice paths in a certain probability model. Along the way a combinatorial identity is proved.

Type
Paper
Copyright
Copyright © Cambridge University Press 2018 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Footnotes

Supported by the Austrian Science Fund (FWF): P 24644-N26 and by the Karl Popper Kolleg ‘Modeling–Simulation–Optimization' funded by the Alpen-Adria-Universität Klagenfurt and by the Carinthian Economic Promotion Fund (KWF).

Supported by an incentive grant of the National Research Foundation of South Africa.

§

An extended abstract containing the ideas of the asymptotic analysis of the dual-pivot quicksort strategies ‘Count’ and ‘Clairvoyant’, as well as the lattice path analysis of this article appeared as [3], and an appendix containing proofs is available as arXiv:1602.04031v1. This article contains additionally a proof that ‘Count’ is indeed the optimal strategy. This led to a major restructuring; the analysis now focuses on this strategy. Moreover, some proofs have been simplified.

References

Aumüller, M. and Dietzfelbinger, M. (2015) Optimal partitioning for dual-pivot quicksort. ACM Trans. Algorithms 12 18.CrossRefGoogle Scholar
Aumüller, M., Dietzfelbinger, M., Heuberger, C., Krenn, D. and Prodinger, H. (2016) Counting zeros in random walks on the integers and analysis of optimal dual-pivot quicksort. In Proceedings of the 27th International Conference on Probabilistic, Combinatorial and Asymptotic Methods for the Analysis of Algorithms.Google Scholar
Aumüller, M., Dietzfelbinger, M., Heuberger, C., Krenn, D. and Prodinger, H. (2016) Dual-pivot quicksort: Optimality, analysis and zeros of associated lattice paths. arxiv.org/abs/1611.00258Google Scholar
Aumüller, M., Dietzfelbinger, M. and Klaue, P. (2016) How good is multi-pivot quicksort? ACM Trans. Algorithms 13 8.CrossRefGoogle Scholar
Flajolet, P. and Sedgewick, R. (2009) Analytic Combinatorics, Cambridge University Press.CrossRefGoogle Scholar
Graham, R. L., Knuth, D. E. and Patashnik, O. (1994) Concrete Mathematics: A Foundation for Computer Science, second edition, Addison-Wesley.Google Scholar
Hackl, B. and Krenn, D. (2015) Asymptotic expansions in SageMath (module in SageMath 6.10 beta2). trac.sagemath.org/17601Google Scholar
Hennequin, P. (1991) Analyse en moyenne d'algorithmes : Tri rapide et arbres de recherche. PhD thesis, École Polytechnique, Palaiseau.Google Scholar
Hoare, C. A. R. (1962) Quicksort. Comput. J. 5 1015.CrossRefGoogle Scholar
Knuth, D. E. (1998) The Art of Computer Programming, Vol. 3: Sorting and Searching, second edition, Addison-Wesley.Google Scholar
Krattenthaler, C. (2015) Lattice path enumeration. In Handbook of Enumerative Combinatorics (Bóna, M., ed), Discrete Mathematics and its Applications series, CRC Press, pp. 589678.CrossRefGoogle Scholar
Mahmoud, H. (2008) Pólya Urn Models, first edition, CRC Press.CrossRefGoogle Scholar
Mohanty, S. G. (1979) Lattice Path Counting and Applications, Probability and Mathematical Statistics series, Academic Press.Google Scholar
Nebel, M. E., Wild, S. and Martínez, C. (2016) Analysis of pivot sampling in dual-pivot quicksort: A holistic analysis of Yaroslavskiy's partitioning scheme. Algorithmica 75 632683.CrossRefGoogle Scholar
OEIS (2017) The On-Line Encyclopedia of Integer Sequences. oeis.orgGoogle Scholar
SageMath (2016) SageMath Mathematics Software (Version 7.4). www.sagemath.orgGoogle Scholar
Schneider, C. (2007) Symbolic summation assists combinatorics. Sém. Lothar. Combin. 56 136.Google Scholar
Schneider, C. (2015) EvaluateMultiSums V0.96, RISC. Unpublished.Google Scholar
Sedgewick, R. (1975) Quicksort. PhD thesis, Stanford University.Google Scholar
Wild, S. (2013) Java 7's dual pivot quicksort. Master's thesis, Universität Kaiserslautern. https://kluedo.ub.uni-kl.de/files/3463/wild-master-thesis.pdfGoogle Scholar
Wild, S. (2016) Dual-pivot quicksort and beyond: Analysis of multiway partitioning and its practical potential. PhD thesis, Universität Kaiserslautern.Google Scholar
Wild, S., Nebel, M. E. and Neininger, R. (2015) Average case and distributional analysis of dual-pivot quicksort. ACM Trans. Algorithms 11 22.CrossRefGoogle Scholar
Yaroslavskiy, V. (2009) Replacement of quicksort in java.util.arrays with new dual-pivot quicksort (archived version of the discussion in the OpenJDK mailing list). mail.openjdk.java.net/pipermail/core-libs-dev/2009-September/002630.htmlGoogle Scholar