Skip to main content
Article
Licensed
Unlicensed Requires Authentication

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

  • 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.

    EMAIL logo
Published/Copyright: June 28, 2018

Abstract

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.

ACM CCS:

About the author

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.

References

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.10.1145/48529.48535Search in Google 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.Search in 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.10.1145/2963102Search in Google 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.10.1145/359576.359579Search in Google Scholar

5. Jon Bentley. Programming pearls: how to sort. Communications of the ACM, 27(4):287–291, April 1984.10.1145/358027.381121Search in Google Scholar

6. Jon L. Bentley and M. Douglas McIlroy. Engineering a sort function. Software: Practice and Experience, 23(11):1249–1265, 1993.10.1002/spe.4380231105Search in Google Scholar

7. Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms. MIT Press, 3rd edition, 2009.Search in 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.Search in Google Scholar

9. C. A. R. Hoare. Quicksort. The Computer Journal, 5(1):10–16, January 1962.10.1093/comjnl/5.1.10Search in Google Scholar

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

11. JDK Bug System. Replace modified mergesort in java.util.arrays.sort with timsort. https://bugs.openjdk.java.net/browse/JDK-6804124, 2009.Search in 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.10.1137/1.9781611973198.6Search in 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.Search in 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.10.1007/s00453-015-0041-7Search in Google Scholar

15. Robert Sedgewick. Implementing Quicksort programs. Communications of the ACM, 21(10):847–857, 1978.10.1145/359619.359631Search in Google Scholar

16. Robert Sedgewick. Quicksort. Reprint of the author’s Ph. D. thesis, Garland Publishing, 1980.Search in 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.Search in 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.10.1007/978-3-642-33090-2_71Search in 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.10.1145/216585.216588Search in Google Scholar

Received: 2018-02-27
Accepted: 2018-02-27
Published Online: 2018-06-28
Published in Print: 2018-07-01

© 2018 Walter de Gruyter GmbH, Berlin/Boston

Downloaded on 16.4.2026 from https://www.degruyterbrill.com/document/doi/10.1515/itit-2018-0012/html
Scroll to top button