A palindromic substring T [i.. j] of a string T is said to be a shortestuniquepalindromic substring (SUPS) in T for an interval [ p, q] if T [i.. j] is a shortestpalindromic substring such that T [i.. j] occurs onl...
详细信息
A palindromic substring T [i.. j] of a string T is said to be a shortestuniquepalindromic substring (SUPS) in T for an interval [ p, q] if T [i.. j] is a shortestpalindromic substring such that T [i.. j] occurs only once in T, and [i, j] contains [p, q]. The SUPS problem is, given a string T of length n, 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(alpha) time after O(n)-time preprocessing, where a is the number of SUPSs to output (Inoue in J Discrete Algorithms 52-53:122-132, 2018). In this paper, we first show that a is at most 4, and the upper bound is tight. We also show that the total sum of lengths of minimal uniquepalindromicsubstrings of string T, which is strongly related to SUPSs, is O(n). Then, we present the first 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(log logW) time and update data structures in amortized O(log s + log logW) time, where W is the size of the window, and s 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) time for preprocessing and answers any k SUPS queries in 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.
暂无评论