English

Balancing Run-Length Straight-Line Programs*

Data Structures and Algorithms 2022-06-28 v1

Abstract

It was recently proved that any SLP generating a given string ww can be transformed in linear time into an equivalent balanced SLP of the same asymptotic size. We show that this result also holds for RLSLPs, which are SLPs extended with run-length rules of the form ABtA \rightarrow B^t for t>2t>2, deriving exp(A)=exp(B)t\texttt{exp}(A) = \texttt{exp}(B)^t. An immediate consequence is the simplification of the algorithm for extracting substrings of an RLSLP-compressed string. We also show that several problems like answering RMQs and computing Karp-Rabin fingerprints on substrings can be solved in O(grl)\mathcal{O}(g_{rl}) space and O(logn)\mathcal{O}(\log n) time, grlg_{rl} being the size of the smallest RLSLP generating the string, of length nn. We extend the result to solving more general operations on string ranges, in O(grl)\mathcal{O}(g_{rl}) space and O(logn)\mathcal{O}(\log n) applications of the operation. In general, the smallest RLSLP can be asymptotically smaller than the smallest SLP by up to an O(logn)\mathcal{O}(\log n) factor, so our results can make a difference in terms of the space needed for computing these operations efficiently for some string families.

Keywords

Cite

@article{arxiv.2206.13027,
  title  = {Balancing Run-Length Straight-Line Programs*},
  author = {Gonzalo Navarro and Francisco Olivares and Cristian Urbina},
  journal= {arXiv preprint arXiv:2206.13027},
  year   = {2022}
}

Comments

Funded in part by Basal Funds FB0001, Fondecyt Grant 1-200038, and two Conicyt Doctoral Scholarships, ANID, Chile

R2 v1 2026-06-24T12:04:41.604Z