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

静态与非静态字符串中计算唯一回文的数据结构

Data structures for computing unique palindromes in static and non-static strings

Takuya Mieno, Mitsuru Funakoshi

AI总结:

本文针对字符串最短唯一回文子串(SUPS)查询问题,证明了SUPS数量的紧上界,提出了静态场景下O(n)比特空间、常数查询时间的数据结构,还给出了滑动窗口、编辑后模型的高效算法及带约束范围最小值查询的全动态数据结构。

摘要:

字符串$T$的回文子串$T[i..j]$若满足:是最短的回文子串、在$T$中仅出现一次,且区间$[i,j]$包含查询区间$[p,q]$,则称其为$T$中针对区间$[p,q]$的最短唯一回文子串(SUPS)。SUPS问题的目标是:给定长度为$n$的字符串$T$,构建一个数据结构,能够对任意给定的查询区间计算所有SUPS。已有研究表明,经过$O(n)$时间的预处理后,任意SUPS查询可在$O(α)$时间内得到解答,其中$α$为待输出的SUPS数量[Inoue等人,2018]。\n本文首先证明$α$的上界为4,且该上界是紧的;同时证明与SUPS密切相关的字符串$T$的极小唯一回文子串的长度总和为$O(n)$。随后,我们提出了首个占用$O(n)$比特空间、可在常数时间内解答任意SUPS查询的数据结构。\n针对滑动窗口场景下的SUPS问题,我们提出了一种算法:查询时间为$O(\text{log}\text{log}W)$,数据结构的更新摊还时间为$O(\text{log}σ+\text{log}\text{log}W)$,其中$W$为窗口大小,$σ$为字母表大小。此外,我们还研究了编辑后模型下的SUPS问题并提出高效算法:预处理时间为$O(n)$,在单字符替换操作后,任意$k$次SUPS查询的解答时间为$O(\text{log}n\text{log}\text{log}n+k\text{log}\text{log}n)$。\n最后,作为副产物,我们提出了一种带约束的范围最小值查询(RmQs)全动态数据结构,其约束为每个查询范围的宽度限定为多对数级别。该带约束的RmQ数据结构可在常数时间内解答查询,且支持摊还常数时间的单元素编辑操作。

英文摘要:

A palindromic substring $T[i.. j]$ of a string $T$ is said to be a shortest unique palindromic substring (SUPS) in $T$ for an interval $[p, q]$ if $T[i.. j]$ is a shortest palindromic substring such that $T[i.. j]$ occurs only once in $T$, and $[i, j]$ contains $[p, q]$. The SUPS problem is, given a string $T$ of length $n$, to construct a data structure that can compute all the SUPSs for any given query interval. It is known that any SUPS query can be answered in $O(α)$ time after $O(n)$-time preprocessing, where $α$ is the number of SUPSs to output [Inoue et al., 2018]. In this paper, we first show that $α$ is at most $4$, and the upper bound is tight. We also show that the total sum of lengths of minimal unique palindromic substrings of string $T$, which is strongly related to SUPSs, is $O(n)$. Then, we present the first $O(n)$-bits data structures that can answer any SUPS query in constant time. Also, we present an algorithm to solve the SUPS problem for a sliding window that can answer any query in $O(\log\log W)$ time and update data structures in amortized $O(\logσ+ \log\log W)$ time, where $W$ is the size of the window, and $σ$ is the alphabet size. Furthermore, we consider the SUPS problem in the after-edit model and present an efficient algorithm. Namely, we present an algorithm that uses $O(n)$ time for preprocessing and answers any $k$ SUPS queries in $O(\log n\log\log n + k\log\log n)$ time after single character substitution. Finally, as a by-product, we propose a fully-dynamic data structure for range minimum queries (RmQs) with a constraint where the width of each query range is limited to poly-logarithmic. The constrained RmQ data structure can answer such a query in constant time and support a single-element edit operation in amortized constant time.

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

↑