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

滑动窗口的回文树及其应用

Palindromic Trees for a Sliding Window and Its Applications

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

摘要:

回文树(Palindromic Tree)eertree)是一种树状数据结构,使用$O(n)$空间表示$S$的所有不同回文子串的集合[Rubinchik和Shur,2018]。已知,当$S$在大小为$σ$的字母表上并且以在线方式给出时,则$S$的回文树可以在$O(n\logσ)$时间与$O(n)$空间中构造。在本文中,我们考虑的滑动窗口版本的问题:对于一个滑动窗口的长度最多$d$,我们提出了两个版本的算法,保持的回文树的大小$O(d)$为每个滑动窗口$S[i..j]$在$S$,其中$1 \leq j-i+1 \leq d$。第一个版本以$O(n\logσ')$时间和$O(d)$空间工作,其中$σ' \leq d$是窗口中不同字符的最大数量,第二个版本以$O(n + dσ)$时间和$(d+2)σ+ O(d)$空间工作。我们还展示了如何我们的算法可以应用到最小的唯一回文子串(MUPS)和最小的缺席回文字(MAPW)的滑动窗口的有效计算。

英文摘要:

The palindromic tree (a.k.a. eertree) for a string $S$ of length $n$ is a tree-like data structure that represents the set of all distinct palindromic substrings of $S$, using $O(n)$ space [Rubinchik and Shur, 2018]. It is known that, when $S$ is over an alphabet of size $σ$ and is given in an online manner, then the palindromic tree of $S$ can be constructed in $O(n\logσ)$ time with $O(n)$ space. In this paper, we consider the sliding window version of the problem: For a sliding window of length at most $d$, we present two versions of an algorithm which maintains the palindromic tree of size $O(d)$ for every sliding window $S[i..j]$ over $S$, where $1 \leq j-i+1 \leq d$. The first version works in $O(n\logσ')$ time with $O(d)$ space where $σ' \leq d$ is the maximum number of distinct characters in the windows, and the second one works in $O(n + dσ)$ time with $(d+2)σ+ O(d)$ space. We also show how our algorithms can be applied to efficient computation of minimal unique palindromic substrings (MUPS) and minimal absent palindromic words (MAPW) for a sliding window.

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

↑