TL;DR
Sorting under persistent random comparison errors—where repeating a comparison always yields the same faulty answer—has long seemed computationally harder than standard sorting. This paper settles the open problem of its time complexity by introducing RiffleSort, the first $O(n \log n)$-time algorithm that simultaneously achieves optimal $O(\log n)$ maximum dislocation and $O(n)$ total dislocation with high probability. In short, persistent comparison errors do not make sorting asymptotically slower than error-free sorting.
What Problem Does This Paper Address?
In classical noisy sorting models, errors are non-persistent: if you compare two items multiple times, errors are independent, so taking a majority vote over $O(\log n)$ repetitions easily solves the problem.
In the persistent errors model (introduced by Braverman and Mossel, SODA 2008), every pair of distinct elements has an independent probability $p < 1/2$ of returning the wrong comparison outcome, but each comparison outcome is fixed forever. You cannot resample or repeat a comparison to filter out noise. Under this constraint, perfect sorting is mathematically impossible. The standard metric of quality is dislocation—the absolute difference between an element’s true sorted rank and its index in the output array:
- Maximum dislocation: $\max_x |\text{pos}(x) - \text{rank}(x)|$ (known lower bound: $\Omega(\log n)$ w.h.p.)
- Total dislocation: $\sum_x |\text{pos}(x) - \text{rank}(x)|$ (known lower bound: $\Omega(n)$ in expectation)
Previous algorithms achieved the optimal $O(\log n)$ maximum dislocation, but required superlinear comparison counts and running times—ranging from $\tilde{O}(n^{3/2})$ to $O(n^2)$ or even $O(n^{3+c_p})$. The fundamental question remained: Can we sort in optimal $O(n \log n)$ time with optimal dislocation under persistent errors?
Methods
The authors resolve this question with two primary algorithmic innovations:
-
Noisy Binary Search with Persistent Errors: To insert an element $x$ into an almost-sorted sequence $S$ (dislocation $d \ge \log n$) in $O(\log n)$ time without blowing up dislocation, the authors design a random-walk search on a binary tree:
-
Because comparisons cannot be repeated, querying a tree node tests $x$ against the boundary elements of that node's assigned interval and then expands the interval pointers outward, ensuring any future visit to that node compares $x$ against fresh elements.
- To prevent overlapping dynamic intervals from confusing the search, the algorithm maintains two separate trees ($T_0$ and $T_1$) over interleaved sets of position groups, guaranteeing that at least one tree behaves reliably like an error-tolerant random walk with backtracking.
- RiffleSort:
- The algorithm partitions the input into geometrically doubling subsets $T_0, T_1, \dots, T_k$ (where $|T_0| = \sqrt{n}$ and $|T_i| = 2^{i-1}\sqrt{n}$).
- It starts by approximately sorting $T_0$ using an existing local sorter (
WindowSort). - In iteration $i$, it calls
Mergeto simultaneously insert the elements of $T_i$ into the sorted array $S_{i-1}$ using the noisy binary search. - Crucially, merging expands the dislocation by a constant multiplicative factor $\gamma$. To prevent this error from compounding across iterations, RiffleSort immediately runs
WindowSortwith window size $O(\log n)$, which contracts the dislocation back down to $c_p \log n$. - Derandomization: The only randomized step in RiffleSort is selecting the subsets $T_i$. The authors show this can be derandomized without external randomness by XORing independent noisy comparison results between a small set of $O(\log n)$ elements and the rest of the array, producing almost-fair coin flips that behave like unbiased random bits.
Datasets
Not discussed in the paper. (This is a theoretical computer science paper evaluated entirely via rigorous mathematical proofs; no empirical datasets or benchmarks were used.)
Key Insights and Ideas
- Persistent noise demands dynamic intervals: In non-persistent search, backtracking repeats the exact same comparison. In persistent search, repeating a comparison yields zero new information. Dynamically expanding the boundary pointers at each node converts what would be an uninformative duplicate query into a fresh independent comparison with neighboring elements.
- Interleaving expansion with contraction: Merging doubles the dataset and multiplies the dislocation by a constant factor $\gamma$. Directly recursing would cause dislocation to explode. By interleaving each merge step with a linear-time local pass (
WindowSort), the maximum dislocation is repeatedly reset to $O(\log n)$ before the next merge. - Free randomness from the noise itself: The noisy channel itself provides entropy. Comparing $O(\log n)$ designated items against the remaining items provides enough independent Bernoulli trials to extract unbiased random bits via XOR parity, removing any requirement for external random bits.
Key Results
- Running Time: $O(n \log n)$ worst-case time (both randomized and deterministic versions).
- Dislocation Guarantees:
- Maximum dislocation: $O(\log n)$ with high probability ($1 - O(n^{-3/2})$).
- Total dislocation: $O(n)$ with high probability.
- Search Complexity: Locating the approximate rank of an element in an almost-sorted array takes optimal $O(\log n)$ time with failure probability at most $O(n^{-6})$.
- Optimality: Matches the information-theoretic lower bounds for comparison sorting ($\Omega(n \log n)$ time) and the problem's known dislocation lower bounds ($\Omega(\log n)$ maximum and $\Omega(n)$ total dislocation).
Limitations and Future Work
- Error Probability Range: While the noisy binary search tree handles any constant error probability $p < 1/2$, the overall sorting algorithm relies on
WindowSort, which currently restricts the error rate to $p < 1/16$ (assumed $p \le 1/32$ for clean constant factors in the paper). Extending the $O(n \log n)$ algorithm to all $p \in (0, 1/2)$ remains open. - Adversarial Ordering in Deterministic Setting: The deterministic variant requires the initial permutation of $S$ to be independent of the comparison errors; an adaptive adversary who sees the error matrix before arranging $S$ can break the derandomized coin-extraction scheme.
Summary updated