English

Data structures for computing unique palindromes in static and non-static strings

Data Structures and Algorithms 2023-08-30 v2

Abstract

A palindromic substring T[i..j]T[i.. j] of a string TT is said to be a shortest unique palindromic substring (SUPS) in TT for an interval [p,q][p, q] if T[i..j]T[i.. j] is a shortest palindromic substring such that T[i..j]T[i.. j] occurs only once in TT, and [i,j][i, j] contains [p,q][p, q]. The SUPS problem is, given a string TT of length nn, to construct a data structure that can compute all the SUPSs for any given query interval. It is known that any SUPS query can be answered in O(α)O(\alpha) time after O(n)O(n)-time preprocessing, where α\alpha is the number of SUPSs to output [Inoue et al., 2018]. In this paper, we first show that α\alpha is at most 44, and the upper bound is tight. We also show that the total sum of lengths of minimal unique palindromic substrings of string TT, which is strongly related to SUPSs, is O(n)O(n). Then, we present the first O(n)O(n)-bits data structures that can answer any SUPS query in constant time. Also, we present an algorithm to solve the SUPS problem for a sliding window that can answer any query in O(loglogW)O(\log\log W) time and update data structures in amortized O(logσ+loglogW)O(\log\sigma + \log\log W) time, where WW is the size of the window, and σ\sigma is the alphabet size. Furthermore, we consider the SUPS problem in the after-edit model and present an efficient algorithm. Namely, we present an algorithm that uses O(n)O(n) time for preprocessing and answers any kk SUPS queries in O(lognloglogn+kloglogn)O(\log n\log\log n + k\log\log n) time after single character substitution. Finally, as a by-product, we propose a fully-dynamic data structure for range minimum queries (RmQs) with a constraint where the width of each query range is limited to poly-logarithmic. The constrained RmQ data structure can answer such a query in constant time and support a single-element edit operation in amortized constant time.

Keywords

Cite

@article{arxiv.2204.07327,
  title  = {Data structures for computing unique palindromes in static and non-static strings},
  author = {Takuya Mieno and Mitsuru Funakoshi},
  journal= {arXiv preprint arXiv:2204.07327},
  year   = {2023}
}
R2 v1 2026-06-24T10:48:54.040Z