Shortest Unique Palindromic Substring Queries on Run-Length Encoded Strings - Watanabe, Kiichi; Nakashima, Yuto; Inenaga, Shunsuke; Bannai, Hideo; Takeda, Masayuki (Combinatorial Algorithms, 2019)
For a string S, a palindromic substring S[i..j] is said to be a shortest unique palindromic substring ( $$ SUPS $$ ) for an interval [s, t] in S, if S[i..j] occurs exactly once in S, the interval [i, j] contains [s, t], and every palindromic substring containing [s, t] which is shorter than S[i..j] occurs at least twice in S. In this paper, we study the problem of answering $$ SUPS $$ queries on run-length encoded strings. We show how to preprocess a given run-length encoded string $$ RLE _{S}$$ of size m in O(m) space and $$O(m \log σ _{ RLE _{S}} + m \sqrt{\log m / \log \log m})$$ time so that all $$ SUPSs $$ for any subsequent query interval can be answered in $$O(\sqrt{\log m / \log \log m} + α )$$ time, where $$α $$ is the number of outputs, and $$σ _{ RLE _{S}}$$ is the number of distinct runs of $$ RLE _{S}$$ .