English

Finding Top-k Longest Palindromes in Substrings

Data Structures and Algorithms 2023-06-21 v4

Abstract

Palindromes are strings that read the same forward and backward. Problems of computing palindromic structures in strings have been studied for many years with a motivation of their application to biology. The longest palindrome problem is one of the most important and classical problems regarding palindromic structures, that is, to compute the longest palindrome appearing in a string TT of length nn. The problem can be solved in O(n)O(n) time by the famous algorithm of Manacher [Journal of the ACM, 1975]. This paper generalizes the longest palindrome problem to the problem of finding top-kk longest palindromes in an arbitrary substring, including the input string TT itself. The internal top-kk longest palindrome query is, given a substring T[i..j]T[i..j] of TT and a positive integer kk as a query, to compute the top-kk longest palindromes appearing in T[i..j]T[i.. j]. This paper proposes a linear-size data structure that can answer internal top-kk longest palindromes query in optimal O(k)O(k) time. Also, given the input string TT, our data structure can be constructed in O(nlogn)O(n\log n) time. For k=1k = 1, the construction time is reduced to O(n)O(n).

Keywords

Cite

@article{arxiv.2210.02000,
  title  = {Finding Top-k Longest Palindromes in Substrings},
  author = {Kazuki Mitani and Takuya Mieno and Kazuhisa Seto and Takashi Horiyama},
  journal= {arXiv preprint arXiv:2210.02000},
  year   = {2023}
}
R2 v1 2026-06-28T02:49:29.142Z