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 T of length n. The problem can be solved in \(\mathcal {O}(n)\) time by the famous algorithm of Manacher [Journal of the ACM, 1975]. In this paper, we consider the problem in the internal model. The internal longest palindrome query is, given a substring T[i..j] of T as a query, to compute the longest palindrome appearing in T[i..j]. The best known data structure for this problem is the one proposed by Amir et al. [Algorithmica, 2020], which can answer any query in \(\mathcal {O}(\log n)\) time. In this paper, we propose a linear-size data structure that can answer any internal longest palindrome query in constant time. Also, given the input string T, our data structure can be constructed in \(\mathcal {O}(n)\) time.
Partially supported by JSPS KAKENHI Grant Numbers JP20H05964.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Abedin, P., et al.: A linear-space data structure for range-LCP queries in poly-logarithmic time. Theor. Comput. Sci. 822, 15ā22 (2020)
Abedin, P., Ganguly, A., Pissis, S.P., Thankachan, S.V.: Efficient data structures for range shortest unique substring queries. Algorithms 13(11), 1ā9 (2020)
Agarwal, P.K.: Range Searching. In: Handbook of Discrete and Computational Geometry, pp. 1057ā1092. Chapman and Hall/CRC, Boca Raton (2017)
Alstrup, S., Brodal, G.S., Rauhe, T.: New data structures for orthogonal range searching. In: 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, p. 198. IEEE Computer Society (2000)
Amir, A., Apostolico, A., Landau, G.M., Levy, A., Lewenstein, M., Porat, E.: Range LCP. J. Comput. Syst. Sci. 80(7), 1245ā1253 (2014)
Amir, A., Boneh, I.: Dynamic palindrome detection. arXiv preprint arXiv:1906.09732 (2019)
Amir, A., Charalampopoulos, P., Pissis, S.P., Radoszewski, J.: Dynamic and internal longest common substring. Algorithmica 82(12), 3707ā3743 (2020)
Amir, A., Landau, G.M., Lewenstein, M., Sokol, D.: Dynamic text and static pattern matching. ACM Trans. Algorithms 3(2), 19 (2007)
Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1), 163ā173 (1995)
Babenko, M., Gawrychowski, P., Kociumaka, T., Kolesnichenko, I., Starikovskaya, T.: Computing minimal and maximal suffixes of a substring. Theor. Comput. Sci. 638, 112ā121 (2016)
Badkobeh, G., Charalampopoulos, P., Kosolobov, D., Pissis, S.P.: Internal shortest absent word queries in constant time and linear space. Theor. Comput. Sci. 922, 271ā282 (2022)
Bentley, J.L.: Multidimensional divide-and-conquer. Commun. ACM 23(4), 214ā229 (1980)
Charalampopoulos, P., Gawrychowski, P., Mozes, S., Weimann, O.: An almost optimal edit distance oracle. In: 48th International Colloquium on Automata, Languages, and Programming (ICALP 2021). Schloss Dagstuhl-Leibniz-Zentrum fĆ¼r Informatik (2021)
Charalampopoulos, P., Kociumaka, T., Mohamed, M., Radoszewski, J., Rytter, W., WaleÅ, T.: Internal dictionary matching. Algorithmica 83(7), 2142ā2169 (2021)
Charalampopoulos, P., Kociumaka, T., Wellnitz, P.: Faster approximate pattern matching: a unified approach. In: 2020 IEEE 61st Annual Symposium on Foundations of Computer Science (FOCS), pp. 978ā989. IEEE (2020)
Droubay, X., Justin, J., Pirillo, G.: Episturmian words and some constructions of de Luca and Rauzy. Theor. Comput. Sci. 255(1ā2), 539ā553 (2001)
Fischer, J., Heun, V.: Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM J. Comput. 40(2), 465ā492 (2011)
Funakoshi, M., Nakashima, Y., Inenaga, S., Bannai, H., Takeda, M.: Computing longest palindromic substring after single-character or block-wise edits. Theor. Comput. Sci. 859, 116ā133 (2021)
Ganardi, M.: Compression by contracting straight-line programs. In: Mutzel, P., Pagh, R., Herman, G. (eds.) 29th Annual European Symposium on Algorithms (ESA 2021). Leibniz International Proceedings in Informatics (LIPIcs), vol. 204, pp. 45:1ā45:16. Schloss Dagstuhl - Leibniz-Zentrum fĆ¼r Informatik (2021)
Ganguly, A., Patil, M., Shah, R., Thankachan, S.V.: A linear space data structure for range LCP queries. Fund. Inform. 163(3), 245ā251 (2018)
Groult, R., Prieur, Ć., Richomme, G.: Counting distinct palindromes in a word in linear time. Inf. Process. Lett. 110(20), 908ā912 (2010)
Gusfield, D.: Algorithms on stings, trees, and sequences: computer science and computational biology. ACM SIGACT News 28(4), 41ā60 (1997)
Kociumaka, T.: Minimal suffix and rotation of a substring in optimal time. In: 27th Annual Symposium on Combinatorial Pattern Matching (CPM 2016), vol. 54, pp. 28:1ā28:12. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2016)
Kociumaka, T.: Efficient data structures for internal queries in texts. Ph.D. thesis, University of Warsaw (2018)
Kociumaka, T., Radoszewski, J., Rytter, W., WaleÅ, T.: Internal pattern matching queries in a text and applications. In: Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 532ā551. SIAM (2014)
Manacher, G.: A new linear-time āon-lineā algorithm for finding the smallest initial palindrome of a string. J. ACM (JACM) 22(3), 346ā351 (1975)
Matsubara, W., Inenaga, S., Ishino, A., Shinohara, A., Nakamura, T., Hashimoto, K.: Efficient algorithms to compute compressed longest common substrings and compressed palindromes. Theor. Comput. Sci. 410(8ā10), 900ā913 (2009)
Matsuda, K., Sadakane, K., Starikovskaya, T., Tateshita, M.: Compressed orthogonal search on suffix arrays with applications to range LCP. In: 31st Annual Symposium on Combinatorial Pattern Matching (CPM 2020). Schloss Dagstuhl-Leibniz-Zentrum fĆ¼r Informatik (2020)
PÄtraÅcu, M., Thorup, M.: Time-space trade-offs for predecessor search. In: Proceedings of the Thirty-Eighth Annual ACM Symposium on Theory of Computing, pp. 232ā240 (2006)
Rubinchik, M., Shur, A.M.: Counting palindromes in substrings. In: Fici, G., Sciortino, M., Venturini, R. (eds.) SPIRE 2017. LNCS, vol. 10508, pp. 290ā303. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-67428-5_25
Rubinchik, M., Shur, A.M.: Eertree: an efficient data structure for processing palindromes in strings. Eur. J. Comb. 68, 249ā265 (2018)
Sakai, Y.: A substring-substring LCS data structure. Theor. Comput. Sci. 753, 16ā34 (2019)
Sakai, Y.: A data structure for substring-substring LCS length queries. Theor. Comput. Sci. 911, 41ā54 (2022)
Tiskin, A.: Semi-local string comparison: algorithmic techniques and applications. Math. Comput. Sci. 1(4), 571ā603 (2008)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
Ā© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Mitani, K., Mieno, T., Seto, K., Horiyama, T. (2023). Internal Longest Palindrome Queries inĀ Optimal Time. In: Lin, CC., Lin, B.M.T., Liotta, G. (eds) WALCOM: Algorithms and Computation. WALCOM 2023. Lecture Notes in Computer Science, vol 13973. Springer, Cham. https://doi.org/10.1007/978-3-031-27051-2_12
Download citation
DOI: https://doi.org/10.1007/978-3-031-27051-2_12
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-27050-5
Online ISBN: 978-3-031-27051-2
eBook Packages: Computer ScienceComputer Science (R0)