Skip to main content

Average Case Analysis of Java 7’s Dual Pivot Quicksort

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7501))

Abstract

Recently, a new Quicksort variant due to Yaroslavskiy was chosen as standard sorting method for Oracle’s Java 7 runtime library. The decision for the change was based on empirical studies showing that on average, the new algorithm is faster than the formerly used classic Quicksort. Surprisingly, the improvement was achieved by using a dual pivot approach, an idea that was considered not promising by several theoretical studies in the past. In this paper, we identify the reason for this unexpected success. Moreover, we present the first precise average case analysis of the new algorithm showing e.g. that a random permutation of length n is sorted using \(1.9n\ln n-2.46n+\mathcal{O}(\ln n)\) key comparisons and \(0.6n\ln n+0.08n+\mathcal{O}(\ln n)\) swaps.

This research was supported by DFG grant NE 1379/3-1.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

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

    Article  MathSciNet  MATH  Google Scholar 

  2. Sedgewick, R.: Quicksort. Phd thesis, Stanford University (1975)

    Google Scholar 

  3. Hennequin, P.: Analyse en moyenne d’algorithme, tri rapide et arbres de recherche. Ph.d. thesis, Ecole Politechnique, Palaiseau (1991)

    Google Scholar 

  4. Frazer, W.D., McKellar, A.C.: Samplesort: A Sampling Approach to Minimal Storage Tree Sorting. Journal of the ACM 17(3), 496–507 (1970)

    Article  MathSciNet  MATH  Google Scholar 

  5. Sanders, P., Winkel, S.: Super Scalar Sample Sort. In: Albers, S., Radzik, T. (eds.) ESA 2004. LNCS, vol. 3221, pp. 784–796. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  6. Leischner, N., Osipov, V., Sanders, P.: GPU sample sort. In: 2010 IEEE International Symposium on Parallel Distributed Processing IPDPS, pp. 1–10. IEEE (2009)

    Google Scholar 

  7. Blelloch, G.E., Leiserson, C.E., Maggs, B.M., Plaxton, C.G., Smith, S.J., Zagha, M.: A comparison of sorting algorithms for the connection machine CM-2. In: Proceedings of the Third Annual ACM Symposium on Parallel Algorithms and Architectures - SPAA 1991, pp. 3–16. ACM Press, New York (1991)

    Chapter  Google Scholar 

  8. Sedgewick, R.: Implementing Quicksort programs. Comm. ACM 21(10), 847–857 (1978)

    Article  MATH  Google Scholar 

  9. Sedgewick, R.: Quicksort with Equal Keys. SIAM Journal on Computing 6(2), 240–267 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  10. Sedgewick, R.: The analysis of Quicksort programs. Acta Inf. 7(4), 327–355 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  11. Hoare, C.A.R.: Algorithm 63: Partition. Comm. 4(7), 321 (1961)

    Google Scholar 

  12. Bentley, J.L.J., McIlroy, M.D.: Engineering a sort function. Software: Practice and Experience 23(11), 1249–1265 (1993)

    Article  Google Scholar 

  13. Hennequin, P.: Combinatorial analysis of Quicksort algorithm. Informatique Théorique et Applications 23(3), 317–333 (1989)

    MathSciNet  MATH  Google Scholar 

  14. Laube, U., Nebel, M.E.: Maximum likelihood analysis of algorithms and data structures. Theoretical Computer Science 411(1), 188–212 (2010)

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Wild, S., Nebel, M.E. (2012). Average Case Analysis of Java 7’s Dual Pivot Quicksort. In: Epstein, L., Ferragina, P. (eds) Algorithms – ESA 2012. ESA 2012. Lecture Notes in Computer Science, vol 7501. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-33090-2_71

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-33090-2_71

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-33089-6

  • Online ISBN: 978-3-642-33090-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics