Double-Ended Palindromic Trees in Linear Time
Qisheng Wang, Ming Yang, Xinrui Zhu
TL;DR
This work addresses online maintenance of palindromic substrings under deque updates, introducing a double-ended eertree that supports push_back, push_front, pop_back, pop_front and palindrome-structure queries. The key idea is a surface recording framework built on reduced sets of occurrences, plus the notion of surfaces that capture the distribution of palindromic substrings in the current string. The authors achieve a linear-time maintenance regime with worst-case per-operation costs of $O^*(\log^*(\sigma))$, reducing to $O^*(1)$ for constant alphabet, and provide two practical implementations. They demonstrate broad applicability to range palindrome queries (counting distinct palindromes, longest palindromic substring, shortest unique palindrome, and shortest absent palindrome) and discuss persistence, block-based trade-offs, and potential extensions to other palindrome structures. The work advances real-time palindrome processing and has potential impact in bioinformatics and advanced string-processing tasks that require online deque updates.
Abstract
The palindromic tree (a.k.a. eertree) is a data structure that provides access to all palindromic substrings of a string. In this paper, we propose a dynamic version of eertree, called double-ended eertree, which supports online operations on the stored string, including double-ended queue operations, counting distinct palindromic substrings, and finding the longest palindromic prefix/suffix. At the heart of our construction, we identify a new class of substring occurrences, called surfaces, that are palindromic substring occurrences that are neither prefixes nor suffixes of any other palindromic substring occurrences, which is of independent interest. Surfaces characterize the link structure of all palindromic substrings in the eertree, thereby allowing a linear-time implementation of double-ended eertrees through a linear-time maintenance of surfaces.
