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(\alpha)$ time after $O(n)$-time preprocessing, where $\alpha$ is the number of SUPSs to output [Inoue et al., 2018]. In this paper, we first show that $\alpha$ 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\sigma + \log\log W)$ time, where $W$ is the size of the window, and $\sigma$ 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.
翻译:字符串 $T$ 的一个回文子串 $T[i.. j]$ 被称为区间 $[p, q]$ 的最短唯一回文子串(SUPS),若 $T[i.. j]$ 是满足以下条件的最短回文子串:$T[i.. j]$ 在 $T$ 中仅出现一次,且区间 $[i, j]$ 包含区间 $[p, q]$。SUPS 问题是指:给定长度为 $n$ 的字符串 $T$,构建一种数据结构,使得对于任意查询区间,能计算所有 SUPS。已知在 $O(n)$ 时间预处理后,任何 SUPS 查询可在 $O(\alpha)$ 时间内回答,其中 $\alpha$ 为待输出 SUPS 的数量 [Inoue 等人, 2018]。本文首先证明 $\alpha$ 至多为 $4$,且该上界是紧的。我们还证明了与 SUPS 密切相关的字符串 $T$ 的最小唯一回文子串的总长度之和为 $O(n)$。接着,我们提出了首个能在常数时间内回答任意 SUPS 查询的 $O(n)$ 比特数据结构。同时,我们提出了一种适用于滑动窗口的 SUPS 问题求解算法:该算法可在 $O(\log\log W)$ 时间内回答任意查询,并在摊还 $O(\log\sigma + \log\log W)$ 时间内更新数据结构,其中 $W$ 为窗口大小,$\sigma$ 为字母表大小。此外,我们考虑了编辑后模型下的 SUPS 问题,并提出一种高效算法:该算法使用 $O(n)$ 时间进行预处理,在单字符替换后,可在 $O(\log n\log\log n + k\log\log n)$ 时间内回答任意 $k$ 个 SUPS 查询。最后,作为副产品,我们提出了一种适用于查询区间宽度受限于多对数规模的完全动态范围最小值查询(RmQ)数据结构。该受约束的 RmQ 数据结构能在常数时间内回答此类查询,并在摊还常数时间内支持单元素编辑操作。