{"title":"Quicksort Is Optimal For Many Equal Keys","authors":"Sebastian Wild","doi":"10.1137/1.9781611975062.2","DOIUrl":null,"url":null,"abstract":"I prove that the average number of comparisons for median-of-$k$ Quicksort (with fat-pivot a.k.a. three-way partitioning) is asymptotically only a constant $\\alpha_k$ times worse than the lower bound for sorting random multisets with $\\Omega(n^\\varepsilon)$ duplicates of each value (for any $\\varepsilon>0$). The constant is $\\alpha_k = \\ln(2) / \\bigl(H_{k+1}-H_{(k+1)/2} \\bigr)$, which converges to 1 as $k\\to\\infty$, 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.","PeriodicalId":340112,"journal":{"name":"Workshop on Analytic Algorithmics and Combinatorics","volume":"19 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-08-17","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Workshop on Analytic Algorithmics and Combinatorics","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1137/1.9781611975062.2","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5
Abstract
I prove that the average number of comparisons for median-of-$k$ Quicksort (with fat-pivot a.k.a. three-way partitioning) is asymptotically only a constant $\alpha_k$ times worse than the lower bound for sorting random multisets with $\Omega(n^\varepsilon)$ duplicates of each value (for any $\varepsilon>0$). The constant is $\alpha_k = \ln(2) / \bigl(H_{k+1}-H_{(k+1)/2} \bigr)$, which converges to 1 as $k\to\infty$, 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.