Table of Contents
Fetching ...

Probabilistic analysis of optimal multi-pivot QuickSort

Cecilia Holmgren, Jasper Ischebeck, Daniel Krenn, Florian Lesny, Ralph Neininger

TL;DR

This work analyzes the number of key comparisons $X_n$ in a multi-pivot QuickSort with $K$ pivots under a uniform random input. It shows that the mean grows like $E[X_n] = \alpha_K n \log n + \beta_K n + o(n)$ and that the normalized error converges to a limit $Z_K$ in distribution and all moments, where $Z_K$ satisfies a fixed-point recursion involving spacings $D$ with $D_i \sim \text{Beta}(1,K)$. The limit $Z_K$ has a smooth density, and the authors establish rate-of-convergence bounds for small $K$ (in Wasserstein and KS metrics) via the contraction method linked to $(K+1)$-ary search trees. As $K$ grows, the leading mean coefficient $\alpha_K$ tends to $1/\log 2$, indicating convergence toward the information-theoretic lower bound for sorting cost.

Abstract

We consider a multi-pivot QuickSort algorithm using $K\in\mathbb{N}$ pivot elements to partition a nonsorted list into $K+1$ sublists in order to proceed recursively on these sublists. For the partitioning stage, various strategies are in use. We focus on the strategy that minimizes the expected number of key comparisons in the standard random model, where the list is given as a uniformly permuted list of distinct elements. We derive asymptotic expansions for the expectation and variance of the number of key comparisons as well as a limit law for all $K\in\mathbb{N}$, where the convergence holds for all (exponential) moments. For $K\le 4$ we also bound the rate of convergence within the Wasserstein and Kolmogorov--Smirnov distance. Our analysis of the expectation is based on classical results for random $m$-ary search trees. For the remaining results, combinatorial considerations are used to make the contraction method applicable.

Probabilistic analysis of optimal multi-pivot QuickSort

TL;DR

This work analyzes the number of key comparisons in a multi-pivot QuickSort with pivots under a uniform random input. It shows that the mean grows like and that the normalized error converges to a limit in distribution and all moments, where satisfies a fixed-point recursion involving spacings with . The limit has a smooth density, and the authors establish rate-of-convergence bounds for small (in Wasserstein and KS metrics) via the contraction method linked to -ary search trees. As grows, the leading mean coefficient tends to , indicating convergence toward the information-theoretic lower bound for sorting cost.

Abstract

We consider a multi-pivot QuickSort algorithm using pivot elements to partition a nonsorted list into sublists in order to proceed recursively on these sublists. For the partitioning stage, various strategies are in use. We focus on the strategy that minimizes the expected number of key comparisons in the standard random model, where the list is given as a uniformly permuted list of distinct elements. We derive asymptotic expansions for the expectation and variance of the number of key comparisons as well as a limit law for all , where the convergence holds for all (exponential) moments. For we also bound the rate of convergence within the Wasserstein and Kolmogorov--Smirnov distance. Our analysis of the expectation is based on classical results for random -ary search trees. For the remaining results, combinatorial considerations are used to make the contraction method applicable.

Paper Structure

This paper contains 9 sections, 12 theorems, 101 equations, 1 figure, 1 table.

Key Result

Theorem 1

Let $K\in {\mathbb N}$. For the number $X_n$ of key comparisons we have with $\alpha_K= \gamma_K/(H_{K+1}-1)$ and a constant $\beta_K \in \mathbb{R}$. In the case of $K≤4$, the error term $o(n)$ can be replaced by $\mathrm{O}(\log n)$.

Figures (1)

  • Figure 1: All comparison trees for $K=3$

Theorems & Definitions (20)

  • Theorem 1
  • Proposition 2
  • Theorem 3
  • Theorem 4
  • Remark 5
  • Theorem 6
  • Theorem 7
  • Lemma 8
  • proof
  • Lemma 9
  • ...and 10 more