1 research outputs found

    Fast Algorithms for the Shortest Unique Palindromic Substring Problem on Run-Length Encoded Strings

    Full text link
    For a string SS, a palindromic substring S[i..j]S[i..j] is said to be a \emph{shortest unique palindromic substring} (SUPS\mathit{SUPS}) for an interval [s,t][s, t] in SS, if S[i..j]S[i..j] occurs exactly once in SS, the interval [i,j][i, j] contains [s,t][s, t], and every palindromic substring containing [s,t][s, t] which is shorter than S[i..j]S[i..j] occurs at least twice in SS. In this paper, we study the problem of answering SUPS\mathit{SUPS} queries on run-length encoded strings. We show how to preprocess a given run-length encoded string RLES\mathit{RLE}_{S} of size mm in O(m)O(m) space and O(mlogσRLES+mlogm/loglogm)O(m \log \sigma_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m}) time so that all SUPSs\mathit{SUPSs} for any subsequent query interval can be answered in O(logm/loglogm+α)O(\sqrt{\log m / \log\log m} + \alpha) time, where α\alpha is the number of outputs, and σRLES\sigma_{\mathit{RLE}_{S}} is the number of distinct runs of RLES\mathit{RLE}_{S}. Additionaly, we consider a variant of the SUPS problem where a query interval is also given in a run-length encoded form. For this variant of the problem, we present two alternative algorithms with faster queries. The first one answers queries in O(loglogm/logloglogm+α)O(\sqrt{\log\log m /\log\log\log m} + \alpha) time and can be built in O(mlogσRLES+mlogm/loglogm)O(m \log \sigma_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m}) time, and the second one answers queries in O(loglogm+α)O(\log \log m + \alpha) time and can be built in O(mlogσRLES)O(m \log \sigma_{\mathit{RLE}_{S}}) time. Both of these data structures require O(m)O(m) space
    corecore