Advertisement

Average Case Analysis of Java 7’s Dual Pivot Quicksort

  • Sebastian Wild
  • Markus E. Nebel
Part of the Lecture Notes in Computer Science book series (LNCS, 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.

Keywords

Expected Number Random Permutation Sorting Method Pivot Element Runtime Library 
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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Hoare, C.A.R.: Quicksort. The Computer Journal 5(1), 10–16 (1962)¸MathSciNetzbMATHCrossRefGoogle Scholar
  2. 2.
    Sedgewick, R.: Quicksort. Phd thesis, Stanford University (1975)Google Scholar
  3. 3.
    Hennequin, P.: Analyse en moyenne d’algorithme, tri rapide et arbres de recherche. Ph.d. thesis, Ecole Politechnique, Palaiseau (1991)Google Scholar
  4. 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)MathSciNetzbMATHCrossRefGoogle Scholar
  5. 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)CrossRefGoogle Scholar
  6. 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. 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)CrossRefGoogle Scholar
  8. 8.
    Sedgewick, R.: Implementing Quicksort programs. Comm. ACM 21(10), 847–857 (1978)zbMATHCrossRefGoogle Scholar
  9. 9.
    Sedgewick, R.: Quicksort with Equal Keys. SIAM Journal on Computing 6(2), 240–267 (1977)MathSciNetzbMATHCrossRefGoogle Scholar
  10. 10.
    Sedgewick, R.: The analysis of Quicksort programs. Acta Inf. 7(4), 327–355 (1977)MathSciNetzbMATHCrossRefGoogle Scholar
  11. 11.
    Hoare, C.A.R.: Algorithm 63: Partition. Comm. 4(7), 321 (1961)Google Scholar
  12. 12.
    Bentley, J.L.J., McIlroy, M.D.: Engineering a sort function. Software: Practice and Experience 23(11), 1249–1265 (1993)CrossRefGoogle Scholar
  13. 13.
    Hennequin, P.: Combinatorial analysis of Quicksort algorithm. Informatique Théorique et Applications 23(3), 317–333 (1989)MathSciNetzbMATHGoogle Scholar
  14. 14.
    Laube, U., Nebel, M.E.: Maximum likelihood analysis of algorithms and data structures. Theoretical Computer Science 411(1), 188–212 (2010)MathSciNetzbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Sebastian Wild
    • 1
  • Markus E. Nebel
    • 1
  1. 1.Fachbereich InformatikTechnische Universität KaiserslauternGermany

Personalised recommendations