an:07310533
Zbl 07310533
Funakoshi, Mitsuru; Nakashima, Yuto; Inenaga, Shunsuke; Bannai, Hideo; Takeda, Masayuki
Computing longest palindromic substring after single-character or block-wise edits
EN
Theor. Comput. Sci. 859, 116-133 (2021).
00458762
2021
j
68Q
palindromes; string algorithms; periodicity
Summary: 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 [12]. 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\).