A Randomised Approach to Distributed Sorting

Sam Olesker-TaylorarXiv 2025 · DOI

This paper, authored by Sam Olesker-Taylor from the University of Warwick, introduces a refreshingly simple randomized approach to distributed sorting. By moving away from the rigid, highly synchronized structures of classical sorting networks, the author demonstrates how a probabilistic "harmonic" approach can achieve efficient sorting that is naturally suited for modern, asynchronous, and potentially faulty distributed systems.

TL;DR

The paper introduces the "Harmonic Sorter," a randomized algorithm that sorts an array by repeatedly picking pairs of indices $\{i, j\}$ with probability proportional to $1/|j - i|$ and sorting them. This simple mechanism achieves $O(n \log^2 n)$ total comparisons and parallelizes to $O(\log^2 n)$ rounds, offering a robust, low-communication alternative to traditional sorting networks.

What Problem Does This Paper Address?

Classical sorting algorithms, while optimal in sequential complexity ($O(n \log n)$), often struggle in the era of "big data" and distributed computing. Traditional sorting networks like Batcher’s Bitonic sort require precise coordination and are sensitive to worst-case inputs or hardware faults. More advanced constructions like the AKS network are theoretically faster ($O(\log n)$ depth) but are notoriously impractical, requiring arrays of size $n \ge 2^{75}$ to outperform simpler methods.

The challenge is to find a sorting mechanism that is:

  1. Simple to implement without complex recursive structures.
  2. Robust against adversarial inputs and hardware failures.
  3. Scalable and amenable to asynchronous parallelization with minimal communication overhead.

Methods

The author defines a framework for graph-based randomized sorters. Imagine a weighted graph where vertices are array positions and edges represent potential comparisons. In each step, the algorithm:

  1. Chooses an edge $\{i, j\}$ from the graph with probability proportional to its weight $w(i, j)$.
  2. Sorts the elements at those two positions (swaps them if they are out of order).

The core contribution is the Harmonic Sorter, where the weight is defined as $w(i, j) = 1/|j - i|$.

The paper also explores two parallel implementations:

  • Deterministic Parallelization: Uses specific "blocks" of matchings (disjoint pairs) to ensure $n/4$ comparisons happen simultaneously.
  • Randomized Parallelization: Each of $p$ computational nodes independently samples an edge to sort, using a simple locking mechanism to handle overlapping pairs.

Datasets

As a theoretical computer science paper, it does not use empirical datasets. Instead, the results are derived through rigorous mathematical proofs, including the 0-1 Principle (which allows one to prove sorting correctness by only considering sequences of zeros and ones), coupling arguments, and stochastic domination.

Key Insights and Ideas

  • The "Goldilocks" Distribution: The paper compares three distributions. A Uniform Sorter (complete graph) is too slow ($O(n^2 \log n)$) because it spends too much time on long-range swaps that don't help fine-tune the order. An Adjacent Sorter (path graph) is also slow ($O(n^2)$) because it lacks long-range movement. The Harmonic Sorter ($1/dist$) is "just right," balancing all scales of distance simultaneously.
  • Scale Invariance: Because the weights grow exponentially as the distance halves, the algorithm is roughly "scale-invariant." It is equally effective at moving an element halfway across the array as it is at performing local corrections.
  • Fault Tolerance by Design: Unlike MergeSort or Bitonic sort, where a single error in a recursive stage can propagate and ruin the entire sort, this randomized approach is "self-correcting." If a swap fails or a node crashes, the algorithm simply continues sampling; it never "unsorts" the data.
  • Hypercube Intuition: The author notes that the Harmonic Sorter is essentially a "relaxed" version of a hypercube sorting network. While the hypercube has a rigid structure, the harmonic distribution spreads that same logic across the entire array, making it easier to analyze and parallelize.

Key Results

  • Sequential Complexity: The Harmonic Sorter requires $O(n \log^2 n)$ comparisons to sort a list of length $n$ with high probability.
  • Parallel Speedup: The parallel versions achieve a linear speedup. With $p \le n/4$ cores, the sorting time drops to $O((n/p) \log^2 n)$ comparisons, or $O(\log^2 n)$ rounds.
  • Communication Efficiency: The synchronous parallel version requires only $O(\log n)$ bits of control information to be broadcast to nodes, making it highly communication-efficient.
  • Comparison with Bitonic Sort: While Bitonic sort has the same $O(\log^2 n)$ parallel depth, the Harmonic Sorter wins on robustness and its ability to operate asynchronously without a centralized "staged" controller.

Limitations and Future Work

  • The $n \log n$ Gap: The author conjectures that $O(n \log^2 n)$ is the fastest possible for this class of randomized sorters, but the information-theoretic lower bound for sorting is $n \log n$. Closing this gap (or proving it's impossible) remains an open question.
  • Hypercube Analysis: While the harmonic sorter is inspired by the hypercube, the author acknowledges that the "rigid" hypercube construction is actually harder to prove correct in this randomized framework.
  • Practical Constants: While the big-O complexity is solid, the paper does not provide empirical benchmarks to show at what value of $n$ this becomes more efficient than a standard parallel MergeSort in a real-world distributed environment.

Summary updated

BibTeX
@misc{oleskertaylor2025randomised,
  author = {Sam Olesker-Taylor},
  title = {{A Randomised Approach to Distributed Sorting}},
  year = {2025},
  eprint = {2502.05082},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.05082},
}
Figure