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

k-回文前缀的小空间编码与识别

Small Space Encoding and Recognition of $k$-Palindromic Prefixes

Gabriel Bathie, Jonas Ellert, Tatiana Starikovskaya

AI总结:

针对k-回文串识别问题,提出其前缀集的结构特征表示方法,推导只读算法实现k-回文前缀紧凑表示及回文长度计算,在空间复杂度上取得优化,部分情况下首次实现输入外o(n)额外空间。

摘要:

回文是正向和反向读取相同的非空字符串。Knuth、Morris和Pratt的开创性论文[SIAM J. Comput., 1977]提出了识别可表示为偶数长度回文串联、长度至少为2的回文串联以及恰好k个回文串联的字符串的问题。在这项工作中,我们研究识别所谓k-回文串的问题,这类串可表示为恰好k个回文的串联。我们展示了以下结果:1. 首先,我们通过将字符串的所有k-回文前缀集表示为少量高度结构化的字符串集(称为仿射前缀集)的并集,给出了其结构特征。以这种方式表示k-回文前缀的长度需要O(6^(k²)·log^k n)的空间。通过构造下界,我们证明对于合理小的k值,空间复杂度在多项式对数因子内是最优的。2. 其次,我们推导了一个只读算法,给定长度为n的字符串T和整数k,该算法为所有1≤i≤k计算T的i-回文前缀的紧凑表示。该算法使用O(n·6^(k²)·log^k n)的时间和O(6^(k²)·log^k n)的空间。3. 最后,我们还给出了一个计算T的回文长度的只读算法,回文长度是使T为ℓ-回文的最小ℓ值。在此,我们实现了O(n·6^(ℓ²)·log^⌈ℓ/2⌉ n)的时间和O(6^(ℓ²)·log^⌈ℓ/2⌉ n)的空间。对于某些ℓ值,这是首个在输入之外使用o(n)额外工作空间的回文长度算法。

英文摘要:

Palindromes are non-empty strings that read the same forward and backward. The problem of recognizing strings that can be represented as the concatenation of even-length palindromes, the concatenation of palindromes of length at least two, and the concatenation of exactly $k$ palindromes was introduced in the seminal paper of Knuth, Morris, and Pratt [SIAM J. Comput., 1977]. In this work, we study the problem of recognizing so-called $k$-palindromic strings, which can be represented as the concatenation of exactly $k$ palindromes. We show the following results: 1. First, we show a structural characterization of the set of all $k$-palindromic prefixes of a string by representing it as a union of a small number of highly structured string sets, called affine prefix sets. Representing the lengths of the $k$-palindromic prefixes in this way requires $O(6^{k^2} \cdot \log^k n)$ space. By constructing a lower bound, we show that the space complexity is optimal up to polylogarithmic factors for reasonably small values of $k$. 2. Secondly, we derive a read-only algorithm that, given a string $T$ of length $n$ and an integer $k$, computes a compact representation of $i$-palindromic prefixes of $T$, for all $1 \le i \le k$. The algorithm uses $O(n \cdot 6^{k^2} \cdot \log^k n)$ time and $O(6^{k^2} \cdot \log^k n)$ space. 3. Finally, we also give a read-only algorithm for computing the palindromic length of $T$, which is the smallest $\ell$ such that $T$ is $\ell$-palindromic. Here, we achieve $O(n \cdot 6^{\ell^2} \cdot \log^{\lceil{\ell/2 \rceil}} n)$ time and $O(6^{\ell^2} \cdot \log^{\lceil{\ell/2\rceil}} n)$ space. For some values of $\ell$, this is the first algorithm for palindromic length that uses $o(n)$ additional working space on top of the input.

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

↑