Problem 141: Two problems on run-length encoded words |
The run-length encoding of a binary word $x\in\sa{1}\{\sa{0},\sa{1}\}^*$ is $$\RLE(x)= \sa{1}^{p_0}\sa{0}^{p_1}\cdots \sa{1}^{p_{s-2}}\sa{0}^{p_{s-1}},$$ where $s-2\geq0$, $p_i\gt 0$ for $i=0,\dots,s-2$ and $p_{s-1}\geq 0$. The value $|\RLE(x)|$ denotes the size of the compressed version of $x$. Note the length $|x|$ can be exponential w.r.t. $\RLE(x)$.
A cover of a non-empty word $x$ is one of its factors whose occurrences cover all positions on $x$. We refer to Problem 45 where a list-oriented computation of covers in standard strings is presented using the prefix table of the word (see Problem 22). Our algorithm here follows similar lines, except that now it operates on sparse sets of (well chosen) positions.