Optimal Partitioning for Dual Pivot Quicksort

(Extended Abstract)
  • Martin Aumüller
  • Martin Dietzfelbinger
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7965)


Dual pivot quicksort refers to variants of classical quicksort where in the partitioning step two pivots are used to split the input into three segments. This can be done in different ways, giving rise to different algorithms. Recently, a dual pivot algorithm due to Yaroslavskiy received much attention, because it replaced the well-engineered quicksort algorithm in Oracle’s Java 7 runtime library. Nebel and Wild (ESA 2012) analyzed this algorithm and showed that on average it uses 1.9nln n + O(n) comparisons to sort an input of size n, beating standard quicksort, which uses 2nln n + O(n) comparisons. We introduce a model that captures all dual pivot algorithms, give a unified analysis, and identify new dual pivot algorithms that minimize the average number of key comparisons among all possible algorithms up to lower order or linear terms. This minimum is 1.8n ln n + O(n).


Small Element Large Element Lower Order Term Optimal Partitioning Medium Element 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aumüller, M., Dietzfelbinger, M.: Optimal partitioning for dual pivot quicksort. CoRR abs/1303.5217 (2013)Google Scholar
  2. 2.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 3rd edn. MIT Press (2009)Google Scholar
  3. 3.
    Hennequin, P.: Analyse en moyenne d’algorithmes: tri rapide et arbres de recherche. Ph.D. thesis, Ecole Politechnique, Palaiseau (1991)Google Scholar
  4. 4.
    Hoare, C.A.R.: Quicksort. Comput. J. 5(1), 10–15 (1962)MathSciNetMATHCrossRefGoogle Scholar
  5. 5.
    Knuth, D.E.: The Art of Computer Programming. Sorting and Searching, vol. III. Addison-Wesley (1973)Google Scholar
  6. 6.
    Sedgewick, R.: Quicksort. Ph.D. thesis, Standford University (1975)Google Scholar
  7. 7.
    Sedgewick, R.: Quicksort with equal keys. SIAM J. Comput. 6(2), 240–268 (1977)MathSciNetMATHCrossRefGoogle Scholar
  8. 8.
    Sedgewick, R.: Implementing quicksort programs. Commun. ACM 21(10), 847–857 (1978)MATHCrossRefGoogle Scholar
  9. 9.
    Sedgewick, R., Flajolet, P.: An introduction to the analysis of algorithms. Addison-Wesley-Longman (1996)Google Scholar
  10. 10.
    Wild, S., Nebel, M.E.: Average case analysis of Java 7’s dual pivot quicksort. In: Epstein, L., Ferragina, P. (eds.) ESA 2012. LNCS, vol. 7501, pp. 825–836. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  11. 11.
    Wild, S., Nebel, M.E., Reitzig, R., Laube, U.: Engineering Java 7’s dual pivot quicksort using MaLiJan. In: ALENEX 2013, pp. 55–69 (2013)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Martin Aumüller
    • 1
  • Martin Dietzfelbinger
    • 1
  1. 1.Faculty of Computer Science and AutomationIlmenau University of TechnologyIlmenauGermany

Personalised recommendations