Skip to main content

Internal Longest Palindrome Queries inĀ Optimal Time

  • Conference paper
  • First Online:
WALCOM: Algorithms and Computation (WALCOM 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13973))

Included in the following conference series:

  • 455 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Abedin, P., et al.: A linear-space data structure for range-LCP queries in poly-logarithmic time. Theor. Comput. Sci. 822, 15ā€“22 (2020)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  2. 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)

    Google ScholarĀ 

  3. Agarwal, P.K.: Range Searching. In: Handbook of Discrete and Computational Geometry, pp. 1057ā€“1092. Chapman and Hall/CRC, Boca Raton (2017)

    Google ScholarĀ 

  4. 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)

    Google ScholarĀ 

  5. Amir, A., Apostolico, A., Landau, G.M., Levy, A., Lewenstein, M., Porat, E.: Range LCP. J. Comput. Syst. Sci. 80(7), 1245ā€“1253 (2014)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  6. Amir, A., Boneh, I.: Dynamic palindrome detection. arXiv preprint arXiv:1906.09732 (2019)

  7. Amir, A., Charalampopoulos, P., Pissis, S.P., Radoszewski, J.: Dynamic and internal longest common substring. Algorithmica 82(12), 3707ā€“3743 (2020)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  8. Amir, A., Landau, G.M., Lewenstein, M., Sokol, D.: Dynamic text and static pattern matching. ACM Trans. Algorithms 3(2), 19 (2007)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  9. Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1), 163ā€“173 (1995)

    ArticleĀ  MATHĀ  Google ScholarĀ 

  10. 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)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  11. 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)

    Google ScholarĀ 

  12. Bentley, J.L.: Multidimensional divide-and-conquer. Commun. ACM 23(4), 214ā€“229 (1980)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  13. 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)

    Google ScholarĀ 

  14. Charalampopoulos, P., Kociumaka, T., Mohamed, M., Radoszewski, J., Rytter, W., Waleń, T.: Internal dictionary matching. Algorithmica 83(7), 2142ā€“2169 (2021)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  15. 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)

    Google ScholarĀ 

  16. 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)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  17. Fischer, J., Heun, V.: Space-efficient preprocessing schemes for range minimum queries on static arrays. SIAM J. Comput. 40(2), 465ā€“492 (2011)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  18. 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)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  19. 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)

    Google ScholarĀ 

  20. 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)

    MathSciNetĀ  MATHĀ  Google ScholarĀ 

  21. Groult, R., Prieur, Ɖ., Richomme, G.: Counting distinct palindromes in a word in linear time. Inf. Process. Lett. 110(20), 908ā€“912 (2010)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  22. Gusfield, D.: Algorithms on stings, trees, and sequences: computer science and computational biology. ACM SIGACT News 28(4), 41ā€“60 (1997)

    ArticleĀ  Google ScholarĀ 

  23. 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)

    Google ScholarĀ 

  24. Kociumaka, T.: Efficient data structures for internal queries in texts. Ph.D. thesis, University of Warsaw (2018)

    Google ScholarĀ 

  25. 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)

    Google ScholarĀ 

  26. 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)

    Google ScholarĀ 

  27. 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)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  28. 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)

    Google ScholarĀ 

  29. 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)

    Google ScholarĀ 

  30. 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

    ChapterĀ  Google ScholarĀ 

  31. Rubinchik, M., Shur, A.M.: Eertree: an efficient data structure for processing palindromes in strings. Eur. J. Comb. 68, 249ā€“265 (2018)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  32. Sakai, Y.: A substring-substring LCS data structure. Theor. Comput. Sci. 753, 16ā€“34 (2019)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  33. Sakai, Y.: A data structure for substring-substring LCS length queries. Theor. Comput. Sci. 911, 41ā€“54 (2022)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

  34. Tiskin, A.: Semi-local string comparison: algorithmic techniques and applications. Math. Comput. Sci. 1(4), 571ā€“603 (2008)

    ArticleĀ  MathSciNetĀ  MATHĀ  Google ScholarĀ 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Takuya Mieno .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

Ā© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics