# Computing longest palindromic substring after single-character or   block-wise edits

**Authors:** Mitsuru Funakoshi, Yuto Nakashima, Shunsuke Inenaga, Hideo Bannai and, Masayuki Takeda

arXiv: 1901.10722 · 2021-01-11

## TL;DR

This paper introduces efficient algorithms for updating the length of the longest palindromic substring after single-character or block edits, improving query times with linear preprocessing.

## Contribution

It presents novel algorithms that efficiently compute LPS after edits, with optimized query times for character and substring modifications.

## Key findings

- O(n) preprocessing for LPS updates after character edits
- O(n) preprocessing for LPS updates after substring replacements
- Logarithmic query time for character edits, linear for block edits

## Abstract

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.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1901.10722/full.md

## Figures

16 figures with captions in the complete paper: https://tomesphere.com/paper/1901.10722/full.md

## References

37 references — full list in the complete paper: https://tomesphere.com/paper/1901.10722/full.md

---
Source: https://tomesphere.com/paper/1901.10722