Quicksort Is Optimal For Many Equal Keys
arXiv:1608.04906 · doi:10.1137/1.9781611975062.2
Abstract
I prove that the average number of comparisons for median-of- Quicksort (with fat-pivot a.k.a. three-way partitioning) is asymptotically only a constant times worse than the lower bound for sorting random multisets with duplicates of each value (for any ). The constant is , which converges to 1 as , so Quicksort is asymptotically optimal for inputs with many duplicates. This resolves a conjecture by Sedgewick and Bentley (1999, 2002) and constitutes the first progress on the analysis of Quicksort with equal elements since Sedgewick's 1977 article.
v4 is a major reorganization of sections; a shortened version appears in the proceedings of ANALCO 2018