We give algorithms that, given a straight-line program (SLP) with $g$ rules that generates (only) a text $T [1..n]$, builds within $O(g)$ space the Lempel-Ziv (LZ) parse of $T$ (of $z$ phrases) in time $O(n\log^2 n)$ or in time $O(gz\log^2(n/z))$. We also show how to build a locally consistent grammar (LCG) of optimal size $g_{lc} = O(\delta\log\frac{n}{\delta})$ from the SLP within $O(g+g_{lc})$ space and in $O(n\log g)$ time, where $\delta$ is the substring complexity measure of $T$. Finally, we show how to build the LZ parse of $T$ from such a LCG within $O(g_{lc})$ space and in time $O(z\log^2 n \log^2(n/z))$. All our results hold with high probability.
翻译:我们给出算法,对于给定一个产生(仅)文本$T [1..n]$的、具有$g$条规则的直程序(SLP),在$O(g)$空间内以$O(n\log^2 n)$时间或以$O(gz\log^2(n/z))$时间构建$T$的Lempel-Ziv(LZ)解析(包含$z$个短语)。我们还展示了如何从SLP在$O(g+g_{lc})$空间和$O(n\log g)$时间内构建一个局部一致文法(LCG),其最优大小为$g_{lc} = O(\delta\log\frac{n}{\delta})$,其中$\delta$是$T$的子串复杂度度量。最后,我们展示了如何从这样的LCG在$O(g_{lc})$空间和$O(z\log^2 n \log^2(n/z))$时间内构建$T$的LZ解析。我们的所有结果均以高概率成立。