Palindromes are important objects in strings which have been extensively studied from combinatorial, algorithmic, and bioinformatics points of views. It is known that the length of the longest palindromic substrings (LPSs) of a given string T of length n can be computed in O(n) time by Manacher's algorithm [J. ACM '75]. In this paper, we consider the problem of finding the LPS after the string is edited. We present an algorithm that uses O(n) time and space for preprocessing, and answers the length of the LPSs in O(\log (\min \{\sigma, \log n\})) time after a single character substitution, insertion, or deletion, where \sigma denotes the number of distinct characters appearing in T. We also propose an algorithm that uses O(n) time and space for preprocessing, and answers the length of the LPSs in O(\ell + \log \log n) time, after an existing substring in T is replaced by a string of arbitrary length \ell.
翻译:Palindromes 是字符串中的重要对象, 从组合、算法和生物信息学角度对之进行了广泛研究。 已知长度为 n 的字符串中最长的平流亚stries (LPS) 长度可以由 Manacher 的算法 [J. ACM'75] 以 O( n) 时间计算。 在本文中, 我们考虑在字符串编辑后找到 LPS 的问题 。 我们提出了一个算法, 使用 O( n) 时间和空间进行预处理, 并在单字符替换、 插入或删除后回答 LPS 的时间长度(\ min \\\\\\\\ grama,\ log n\ \ ) 。 其中\ gmam 表示在 T 中出现不同字符的数量 。 我们还建议使用 O( n) 时间和空间进行预处理的算法, 并回答 O( ell +\ log\ log n) 时间中 LPS 的长度, 在现有的子字符串被任意长度取代后, 在 O (\\ ell\ ell\ ell\ ) 时间 。