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

子串中Top-k最长回文的查找

Finding Top-k Longest Palindromes in Substrings

Kazuki Mitani, Takuya Mieno, Kazuhisa Seto, Takashi Horiyama

AI总结:

本文将最长回文问题推广为子串top-k最长回文查询问题,提出线性大小的数据结构,可在O(k)时间内响应查询,构建时间为O(n log n),k=1时降至O(n)。

摘要:

回文是指正读和反读都相同的字符串。由于在生物学中的应用价值,字符串回文结构计算问题已被研究多年。最长回文问题是回文结构相关的最重要经典问题之一,即计算长度为$n$的字符串$T$中出现的最长回文,该问题可通过著名的Manacher算法[Journal of the ACM, 1975]在$O(n)$时间内求解。本文将最长回文问题推广为在任意子串(包括输入字符串$T$本身)中查找top-$k$最长回文的问题。内部top-$k$最长回文查询指的是,给定$T$的一个子串$T[i..j]$和正整数$k$作为查询,计算$T[i..j]$中出现的前$k$个最长回文。本文提出了一种线性大小的数据结构,能够以最优的$O(k)$时间响应内部top-$k$最长回文查询。同时,给定输入字符串$T$,我们的数据结构可在$O(n\text{log }n)$时间内构建完成;当$k=1$时,构建时间可降至$O(n)$。

英文摘要:

Palindromes are strings that read the same forward and backward. Problems of computing palindromic structures in strings have been studied for many years with a motivation of their application to biology. The longest palindrome problem is one of the most important and classical problems regarding palindromic structures, that is, to compute the longest palindrome appearing in a string $T$ of length $n$. The problem can be solved in $O(n)$ time by the famous algorithm of Manacher [Journal of the ACM, 1975]. This paper generalizes the longest palindrome problem to the problem of finding top-$k$ longest palindromes in an arbitrary substring, including the input string $T$ itself. The internal top-$k$ longest palindrome query is, given a substring $T[i..j]$ of $T$ and a positive integer $k$ as a query, to compute the top-$k$ longest palindromes appearing in $T[i.. j]$. This paper proposes a linear-size data structure that can answer internal top-$k$ longest palindromes query in optimal $O(k)$ time. Also, given the input string $T$, our data structure can be constructed in $O(n\log n)$ time. For $k = 1$, the construction time is reduced to $O(n)$.

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

↑