A structural theory of repetition-bounded stack sorting
For Khan's questions 2–5 in §9, the paper determines how repetition capacity changes a sorting pass, whether different capacities commute, and when greater capacity can increase the sorting time. An occurrence has a latest possible exit determined by the first strictly greater letter to its right. Within that interval it can be expelled early only by overflow of its own value, so the output can be read off from its exit keys. At finite capacity \(m\), one pass sorts exactly the words avoiding \(231\) and \(2^{m+1}1\). At unlimited capacity only \(231\) remains. A commutation test in occurrence ranks gives first failure at length \(m+3\) for a pair with smaller capacity \(m\) on alphabets of at least three letters. The paper derives sharp length and alphabet thresholds for sorting-time increases, including capacity one versus unlimited, and exact times for selected families. For input \(w_1,\ldots,w_n\), let \(R(i)\) be the first \(j>i\) with \(w_j>w_i\), or \(n+1\) for the final drain. Group positions by common \((w_i,R(i))\) and list a group as \(j_1<\cdots<j_s\) with endpoint \(R\). The exit key is \(E_m(j_r)=j_{r+1}\) if \(m<\infty\) and \(m\le r<s\), and \(R\) otherwise. Sorting all positions by \((E_m(i),w_i,-i)\) gives the exact next word. For \(m<M\), every binary word commutes, and on alphabets with at least three letters the first failure has length \(m+3\). For a fixed support size \(k\), there is no example of increased sorting time as capacity increases when \(k\le3\). With unrestricted capacity pairs the first possible lengths are 7 at \(k=4\), 8 at \(k=5\), and \(k+1\) at \(k\ge6\). Restricting to finite capacities at least two changes the last threshold to \(k+2\). For capacity one versus unlimited such increases require \(k\ge6\) and \(n\ge k+1\). In a word \(ABC\) with all three blocks weakly increasing, \(B\) nonempty below every letter of \(A\), and \(C\) at or above \(\max A\) (or \(\max B\) if \(A\) is empty), the number of passes is \(\sum_x\lceil c_x/m\rceil\) for finite cap, or the number of distinct labels in \(A\) for infinite cap, where \(c_x\) counts copies in \(A\).
Authors
- Zixuan He
Institutions
- University of Glasgow (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-30
- DOI
- https://doi.org/10.5281/zenodo.24668472
- Primary Topic
- semigroups and automata theory
- Type
- preprint