Jump to ContentJump to Main Navigation
Show Summary Details
More options …

it - Information Technology

Methods and Applications of Informatics and Information Technology

Editor-in-Chief: Conrad, Stefan / Molitor, Paul

6 Issues per year

See all formats and pricing
More options …
Volume 60, Issue 3


Dual-pivot and beyond: The potential of multiway partitioning in quicksort

Sebastian Wild
  • Corresponding author
  • University of Waterloo, David R. Cheriton School of Computer Science, DC 2332, University Avenue 200 East, Waterloo, ON N2L 3G1, Canada
  • Email
  • Other articles by this author:
  • De Gruyter OnlineGoogle Scholar
Published Online: 2018-06-28 | DOI: https://doi.org/10.1515/itit-2018-0012


Since 2011 the Java runtime library uses a Quicksort variant with two pivot elements. For reasons that remained unclear for years it is faster than the previous Quicksort implementation by more than 10 %; this is not only surprising because the previous code was highly-tuned and is used in many programming libraries, but also since earlier theoretical investigations suggested that using several pivots in Quicksort is not helpful.

In my dissertation I proved by a comprehensive mathematical analysis of all sensible Quicksort partitioning variants that (a) indeed there is hardly any advantage to be gained from multiway partitioning in terms of the number of comparisons (and more generally in terms of CPU costs), but (b) multiway partitioning does significantly reduce the amount of data to be moved between CPU and main memory. Moreover, this more efficient use of the memory hierarchy is not achieved by any of the other well-known optimizations of Quicksort, but only through the use of several pivots.

Keywords: Quicksort; multiway partitioning; average-case analysis; cache misses; external-memory model

ACM CCS: Theory of computationDesign and analysis of algorithmsData structures design and analysisSorting and searching


  • 1.

    Alok Aggarwal and Jeffrey S. Vitter. The input/output complexity of sorting and related problems. Communications of the ACM, 31(9):1116–1127, August 1988.CrossrefGoogle Scholar

  • 2.

    Tomi T. Ahonen. Smartphone bloodbath market share update q1: All the top 10 brands plus os shares plus installed base. http://communities-dominate.blogs.com/brands/2016/05/smartphone-bloodbath-market-share-update-q1-all-the-top-10-brands-plus-os-shares-plus-installed-base.html, 2016.Google Scholar

  • 3.

    Martin Aumüller, Martin Dietzfelbinger, and Pascal Klaue. How good is multi-pivot quicksort? ACM Transactions on Algorithms, 13(1):1–47, 2016.CrossrefWeb of ScienceGoogle Scholar

  • 4.

    John Backus. Can programming be liberated from the von Neumann style? A functional style and its algebra of programs. Communications of the ACM, 21(8):613–641, August 1978.CrossrefGoogle Scholar

  • 5.

    Jon Bentley. Programming pearls: how to sort. Communications of the ACM, 27(4):287–291, April 1984.Google Scholar

  • 6.

    Jon L. Bentley and M. Douglas McIlroy. Engineering a sort function. Software: Practice and Experience, 23(11):1249–1265, 1993.Google Scholar

  • 7.

    Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. MIT Press, 3rd edition, 2009.Google Scholar

  • 8.

    Pascal Hennequin. Analyse en moyenne d’algorithmes : tri rapide et arbres de recherche. Thèse (Ph. D. Thesis), Ecole Politechnique, Palaiseau, 1991.Google Scholar

  • 9.

    C. A. R. Hoare. Quicksort. The Computer Journal, 5(1):10–16, January 1962.CrossrefGoogle Scholar

  • 10.

    Java Core Library Development Mailing List. Replacement of quicksort in java.util.arrays with new dual-pivot quicksort, 2009.

  • 11.

    JDK Bug System. Replace modified mergesort in java.util.arrays.sort with timsort. https://bugs.openjdk.java.net/browse/JDK-6804124, 2009.Google Scholar

  • 12.

    Shrinu Kushagra, Alejandro López-Ortiz, Aurick Qiao, and J. Ian Munro. Multi-pivot Quicksort: Theory and experiments. In Meeting on Algorithm Engineering and Experiments (ALENEX), pages 47–60. SIAM, 2014.Google Scholar

  • 13.

    John D. McCalpin. Sustainable memory bandwidth in high performance computers. Technical report, University of Virginia, Charlottesville, Virginia, 1991–2007, continually updated technical report.Google Scholar

  • 14.

    Markus E. Nebel, Sebastian Wild, and Conrado Martínez. Analysis of pivot sampling in dual-pivot Quicksort. Algorithmica, 75(4):632–683, August 2016.CrossrefWeb of ScienceGoogle Scholar

  • 15.

    Robert Sedgewick. Implementing Quicksort programs. Communications of the ACM, 21(10):847–857, 1978.CrossrefGoogle Scholar

  • 16.

    Robert Sedgewick. Quicksort. Reprint of the author’s Ph. D. thesis, Garland Publishing, 1980.Google Scholar

  • 17.

    Sebastian Wild. Dual-Pivot Quicksort and Beyond: Analysis of Multiway Partitioning and Its Practical Potential. Doktorarbeit (Ph. D. thesis), Technische Universität Kaiserslautern, 2016. ISBN 978-3-00-054669-3.Google Scholar

  • 18.

    Sebastian Wild and Markus E. Nebel. Average case analysis of Java 7’s dual pivot Quicksort. In Leah Epstein and Paolo Ferragina, editors, European Symposium on Algorithms (ESA), volume 7501 of LNCS, pages 825–836. Springer, 2012.Google Scholar

  • 19.

    William Allen Wulf and Sally A. McKee. Hitting the memory wall: Implications of the obvious. ACM SIGARCH Computer Architecture News, 23(1):20–24, March 1995.CrossrefGoogle Scholar

About the article

Sebastian Wild

Dr. Sebastian Wild studied computer science at Technische Universität Kaiserslautern on a scholarship by Studienstiftung des deutschen Volkes and graduated in 2012 with a Master of Science. After that he did his Ph. D. as wissenschaftlicher Mitarbeiter (employed doctoral candidate with teaching duties) in the research group of Prof. Dr. Markus Nebel. His findings in the field of analysis of algorithms soon led to publications and international collaborations, including a Best Paper Award [18] at the European Symposium on Algorithms 2012. Sebastian was continually involved in teaching. During his studies he was a student tutor and during his Ph. D. years, he was responsible for organizing tutorials and involved in the development of new courses. Sebastian is married and father of three children.

Received: 2018-02-27

Accepted: 2018-02-27

Published Online: 2018-06-28

Published in Print: 2018-07-01

Citation Information: it - Information Technology, Volume 60, Issue 3, Pages 173–177, ISSN (Online) 2196-7032, ISSN (Print) 1611-2776, DOI: https://doi.org/10.1515/itit-2018-0012.

Export Citation

© 2018 Walter de Gruyter GmbH, Berlin/Boston.Get Permission

Comments (0)

Please log in or register to comment.
Log in