English

Optimal-Time Move Structure Construction

Data Structures and Algorithms 2026-04-27 v2

Abstract

The move structure represents a permutation π\pi of [0,n)[0,n) as a covering set of O(r)O(r) disjoint intervals (contiguous subsets of [0,n)[0,n)), where rr is the minimum number of intervals whose values permute together. Formally, r=1+{i[1,n):π(i)1π(i1)}r = 1 + |\{i\in [1,n) : \pi(i) - 1 \neq \pi(i-1)\}|. The move structure takes O(r)O(r) words of space. Given the index of the interval containing ii, it allows computing π(i)\pi(i) and the index of the interval containing π(i)\pi(i) in O(1)O(1)-time. Therefore, for permutations where rnr \ll n, it allows their representation and navigation in significantly compressed space. The previous best O(r)O(r)-space move structure construction algorithm takes O(rlogr)O(r\log r)-time. In this paper, we describe a construction algorithm achieving optimal O(r)O(r)-time and space. We also show that using our improved algorithm within a recent previous work allows the computation of the longest common prefix array in O(r)O(r)-working space and optimal O(n)O(n)-time given the run-length-encoded Burrows-Wheeler transform. Finally, we implement our improved move structure construction algorithm and find that it is faster than the previous best algorithm while using comparable memory.

Keywords

Cite

@article{arxiv.2603.22147,
  title  = {Optimal-Time Move Structure Construction},
  author = {Nathaniel K. Brown and Ahsan Sanaullah and Shaojie Zhang and Ben Langmead},
  journal= {arXiv preprint arXiv:2603.22147},
  year   = {2026}
}
R2 v1 2026-07-01T11:33:36.595Z