It was recently proved that any SLP generating a given string $w$ 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 $A \rightarrow B^t$ for $t>2$, deriving $\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 $\mathcal{O}(g_{rl})$ space and $\mathcal{O}(\log n)$ time, $g_{rl}$ being the size of the smallest RLSLP generating the string, of length $n$. We extend the result to solving more general operations on string ranges, in $\mathcal{O}(g_{rl})$ space and $\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 $\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.
翻译:最近证明,任何生成给定字符串的 SLP 都可以以线性时间将 $w$ 转换为等值平衡的 SLP 。 我们显示, 此结果对于 RLSLP 也持有同样的结果, 这些 RLSP 是 SLP, 以运行长的规则扩展为 $A\ rightrow Bt$$ t$ t$ 2, 产生 $\ textt{ exp} (A) =\ textt{ exp} (B)\ t} 美元。 一个直接的结果是简化提取 RLSLP 压缩字符串的子字符串的等值 。 我们还显示, 回答 RMQs 和计算子字符串上的 Karp- Rabin 指纹等几个问题可以用$\ mathcal{ O} (gr} 空间和 math 时间( log n) 等最小的 RLSLP 值大小。 我们将结果扩展为在字符串中的最小操作操作 。