English

Average Case Analysis of Java 7's Dual Pivot Quicksort

Data Structures and Algorithms 2013-10-29 v1 Probability

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 nn is sorted using 1.9nlnn2.46n+O(lnn)1.9n\ln n-2.46n+\mathcal{O}(\ln n) key comparisons and 0.6nlnn+0.08n+O(lnn)0.6n\ln n+0.08n+\mathcal{O}(\ln n) swaps.

Cite

@article{arxiv.1310.7409,
  title  = {Average Case Analysis of Java 7's Dual Pivot Quicksort},
  author = {Sebastian Wild and Markus E. Nebel},
  journal= {arXiv preprint arXiv:1310.7409},
  year   = {2013}
}

Comments

Best paper award at ESA 2012, recorded talk: http://www.slideshare.net/sebawild/average-case-analysis-of-java-7s-dual-pivot-quicksort

R2 v1 2026-06-22T01:55:22.703Z