arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1903.06290cs.DS
收藏

游程编码字符串上最短唯一回文子串问题的快速算法

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

Kiichi Watanabe, Yuto Nakashima, Shunsuke Inenaga, Hideo Bannai, Masayuki Takeda

摘要:

对于字符串$S$,回文子字符串$S[i..j]$被称为$S$中的$[s, t]$间隔的\emph{shortest unique palindromic substring}($\mathit{SUPS}$),如果$S[i..j]$在$S$中恰好出现一次,则间隔$[i, j]$包含$[s, t]$,并且每个包含比$S[i..j]$短的$[s, t]$的回文子字符串在$S$中至少出现两次。在本文中,我们研究的问题,回答$\mathit{SUPS}$查询行程编码字符串。我们展示了如何预处理一个给定的运行长度编码的字符串$\mathit{RLE}_{S}$的大小$m$在$O(m)$空间和$O(m \log σ_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m})$时间,使所有的$\mathit{SUPSs}$的任何后续查询间隔可以回答在$O(\sqrt{\log m / \log\log m} + α)$时间,其中$α$是输出的数量,和$σ_{\mathit{RLE}_{S}}$是不同的运行的$\mathit{RLE}_{S}$的数量。此外,我们考虑的SUPS问题的一个变种,其中的查询间隔也给出了游程编码的形式。对于这个变种的问题,我们提出了两种替代算法更快的查询。第一个在$O(\sqrt{\log\log m /\log\log\log m} + α)$时间内回答查询,可以在$O(m \log σ_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m})$时间内构建,第二个在$O(\log \log m + α)$时间内回答查询,可以在$O(m \log σ_{\mathit{RLE}_{S}})$时间内构建。这两种数据结构都需要$O(m)$空间。

英文摘要:

For a string $S$, a palindromic substring $S[i..j]$ is said to be a \emph{shortest unique palindromic substring} ($\mathit{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 $\mathit{SUPS}$ queries on run-length encoded strings. We show how to preprocess a given run-length encoded string $\mathit{RLE}_{S}$ of size $m$ in $O(m)$ space and $O(m \log σ_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m})$ time so that all $\mathit{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 $σ_{\mathit{RLE}_{S}}$ is the number of distinct runs of $\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(\sqrt{\log\log m /\log\log\log m} + α)$ time and can be built in $O(m \log σ_{\mathit{RLE}_{S}} + m \sqrt{\log m / \log\log m})$ time, and the second one answers queries in $O(\log \log m + α)$ time and can be built in $O(m \log σ_{\mathit{RLE}_{S}})$ time. Both of these data structures require $O(m)$ space.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑