🤖 AI Summary
This study addresses the problem of efficiently enumerating all maximal closed substrings (MCS) in run-length encoded (RLE) strings. The authors propose a unified approach that operates directly on the RLE representation, leveraging a compact family-based encoding to handle both periodic and aperiodic cases efficiently. Their key contributions include the first algorithm for directly enumerating MCS from RLE without decompression, a proof that all MCS can be fully represented using only O(m²) families—with this bound shown to be tight in certain instances—and an output-sensitive enumeration algorithm. By integrating techniques such as sparse suffix trees, height-driven three-sided range reporting, and McCreight’s balanced priority search trees, the method outputs a compact representation of all MCS in O(m log²m + |F| log m) time and O(m) space, where m is the length of the RLE string and |F| denotes the number of output families.
📝 Abstract
A string $w$ is closed if $|w|=1$, or if $w$ has a non-empty border occurring only as its prefix and suffix. A maximal closed substring (MCS) is a maximal occurrence of a closed string; equivalently, it is a maximal closed repeat (MCR). We study MCS enumeration directly from the run-length encoding (RLE) of a string. For a string $T$ of length $n$ with RLE size $m$, we introduce a compact family representation for all MCS occurrences. We prove that $O(m^2)$ families are always sufficient and sometimes necessary. The representation relies on consecutive occurrence pairs of longest borders, classified by the RLE length of the border. The non-unary non-periodic cases are handled uniformly by a sparse suffix tree on run-start suffixes and height-based three-sided range reporting over RLE-boundary point sets; periodic cases are treated separately. Using McCreight's balanced priority search trees, the compact representation $\mathcal F$ of all MCSs can be listed in $O(m\log^2 m + |\mathcal F|\log m)$ time with $O(m)$ working space.