SearcharxivSearch

arXiv subjects

Alex Zihan Xu

Publications and source records attributed to Alex Zihan Xu.

2 recordsLinked to original sources

Straightforward Entropy-Sensitive Mergesort

In this paper, we present a stable mergesort variant, "directional mergesort", that to sort an array of $n$ elements makes no more than $nH+3n$ comparisons and $1.5nH+O(n)$ moves where $H$ is the run-based entropy of the input sequence, matching the best existing algorithms in run-adaptive sorting. However, our algorithm is surprisingly minimalistic: it leverages only skip checks, i.e., bypassing the merge step when both halves are already in order, and dynamically changing the direction of merging based on the state of the subarrays. As dynamic run scanning is avoided, all merge steps remain static and derivable from $n$, enabling a reduction to $O(1)$ words of stack space (i.e. space usage excluding the merge buffer) in "directional mergesort$^{++}$", thus improving over the predecessors' $O(\lg n)$ words. Importantly, as directional mergesort adapts only to non-decreasing runs, directional mergesort$^{++}$ also applies a parallel set of rules for (strictly) decreasing runs, allowing the algorithm to also adapt to decreasing runs whilst retaining the original comparison bounds.

cs.DS

Upper Bounds for In-Place Sorting with Minimal Moves

We present the first in-place comparison-based sorting algorithm that sorts an array of $n$ elements using $n\lg n + O(n)$ comparisons with exponentially high probability and always $O(n)$ moves. This matches the information-theoretic lower bound up to an additive linear term despite making only linear moves and working in-place. For the worst-case, we present an algorithm that makes $n\lg n + O(n\lg^{(t)}n)$ comparisons and $O(tn)$ data moves, where $t$ is an integer parameter satisfying $2 \leq t \leq \lg^{*}n - 1$ and $\lg^{(t)}n$ denotes the $t$-time iterated logarithm, improving over the previous upper bound of $n\lg n + O(n\lg\lg n)$ comparisons and $O(n)$ moves when using constant $t>2$. We thus achieve the ultimate goal of minimal move in-place sorting via randomization whilst narrowing the gap to this goal in the worst-case. This advance primarily relies on a novel ordered set structure that supports searches in an optimal $\lg n + O(1)$ comparisons for $n$ elements.

cs.DS