Counting and Verifying Maximal Palindromes

  • Tomohiro I
  • Shunsuke Inenaga
  • Hideo Bannai
  • Masayuki Takeda
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6393)


A palindrome is a symmetric string that reads the same forward and backward. Let pals(w) denote the set of maximal palindromes of a string w in which each palindrome is represented by a pair (c, r), where c is the center and r is the radius of the palindrome. We say that two strings w and z are pal-distinct if pals(w) ≠ pals(z). Firstly, we describe the number of pal-distinct strings, and show that we can enumerate all pal-distinct strings in time linear in the output size, for alphabets of size at most 3. These results follow from a close relationship between maximal palindromes and parameterized matching. Secondly, we present a linear time algorithm which finds a string w such that pals(w) is identical to a given set of maximal palindromes.


Palin Rovan 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Allouche, J.P., Baake, M., Cassaigne, J., Damanik, D.: Palindrome complexity. Theoretical Computer Science 292(1), 9–31 (2003)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Anisiu, M.C., Anisiu, V., Kása, Z.: Total palindrome complexity of finite words. Discrete Mathematics 310(1), 109–114 (2010)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Apostolico, A., Breslauer, D., Galil, Z.: Optimal parallel algorithms for periods, palindromes and squares. In: Kuich, W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 296–307. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  4. 4.
    Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theoretical Computer Science 141, 163–173 (1995)MathSciNetCrossRefMATHGoogle Scholar
  5. 5.
    Baker, B.S.: Parameterized pattern matching: Algorithms and applications. Journal of Computer and System Sciences 52(1), 28–42 (1996)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Bannai, H., Inenaga, S., Shinohara, A., Takeda, M.: Inferring strings from graphs and arrays. In: Rovan, B., Vojtáš, P. (eds.) MFCS 2003. LNCS, vol. 2747, pp. 208–217. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  7. 7.
    Breslauer, D., Galil, Z.: Finding all periods and initial palindromes of a string in parallel. Algorithmica 14(4), 355–366 (1995)MathSciNetCrossRefMATHGoogle Scholar
  8. 8.
    Clément, J., Crochemore, M., Rindone, G.: Reverse engineering prefix tables. In: Proc. STACS 2009, pp. 289–300 (2009)Google Scholar
  9. 9.
    Crochemore, M., Iliopoulos, C., Pissis, S., Tischler, G.: Cover array string reconstruction. In: Amir, A., Parida, L. (eds.) Combinatorial Pattern Matching. LNCS, vol. 6129, pp. 251–259. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  10. 10.
    Currie, J.D.: Palindrome positions in ternary square-free words. Theoretical Computer Science 396(1-3), 254–257 (2008)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Droubay, X.: Palindromes in the Fibonacci word. Information Processing Letters 55(4), 217–221 (1995)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Droubay, X., Pirillo, G.: Palindromes and Sturmian words. Theoretical Computer Science 223(1-2), 73–85 (1999)MathSciNetCrossRefMATHGoogle Scholar
  13. 13.
    Duval, J.P., Lecroq, T., Lefebvre, A.: Efficient validation and construction of border arrays and validation of string matching automata. RAIRO - Theoretical Informatics and Applications 43(2), 281–297 (2009)MathSciNetCrossRefMATHGoogle Scholar
  14. 14.
    Duval, J.P., Lecroq, T., Lefevre, A.: Border array on bounded alphabet. Journal of Automata, Languages and Combinatorics 10(1), 51–60 (2005)MathSciNetMATHGoogle Scholar
  15. 15.
    Duval, J.P., Lefebvre, A.: Words over an ordered alphabet and suffix permutations. Theoretical Informatics and Applications 36, 249–259 (2002)MathSciNetCrossRefMATHGoogle Scholar
  16. 16.
    Franek, F., Gao, S., Lu, W., Ryan, P.J., Smyth, W.F., Sun, Y., Yang, L.: Verifying a border array in linear time. J. Comb. Math. and Comb. Comp. 42, 223–236 (2002)MathSciNetMATHGoogle Scholar
  17. 17.
    Gasieniec, L., Karpinski, M., Plandowski, W., Rytter, W.: Efficient algorithms for Lempel-Ziv encoding. In: Karlsson, R., Lingas, A. (eds.) SWAT 1996. LNCS, vol. 1097, pp. 392–403. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  18. 18.
    Gawrychowski, P., Jez, A., Jez, L.: Validating the Knuth-Morris-Pratt failure function, fast and online. In: Ablayev, F., Mayr, E.W. (eds.) Computer Science – Theory and Applications. LNCS, vol. 6072, pp. 132–143. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  19. 19.
    Glen, A.: Occurrences of palindromes in characteristic Sturmian words. Theoretical Computer Science 352(1), 31–46 (2006)MathSciNetCrossRefMATHGoogle Scholar
  20. 20.
    Gusfield, D.: Algorithms on Strings, Trees, and Sequences. Cambridge University Press, New York (1997)CrossRefMATHGoogle Scholar
  21. 21.
    Hsu, P.H., Chen, K.Y., Chao, K.M.: Finding all approximate gapped palindromes. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 1084–1093. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  22. 22.
    I, T., Inenaga, S., Bannai, H., Takeda, M.: Counting parameterized border arrays for a binary alphabet. In: Dediu, A.H., Ionescu, A.M., Martín-Vide, C. (eds.) LATA 2009. LNCS, vol. 5457, pp. 422–433. Springer, Heidelberg (2009)Google Scholar
  23. 23.
    I, T., Inenaga, S., Bannai, H., Takeda, M.: Verifying a parameterized border array in O(n 1.5) time. In: Amir, A., Parida, L. (eds.) Combinatorial Pattern Matching. LNCS, vol. 6129, pp. 238–250. Springer, Heidelberg (2010)Google Scholar
  24. 24.
    Knuth, D.E., Morris, J.H., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)MathSciNetCrossRefMATHGoogle Scholar
  25. 25.
    Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theoretical Computer Science 410(51), 5365–5373 (2009)MathSciNetCrossRefMATHGoogle Scholar
  26. 26.
    de Luca, A., Luca, A.D.: Palindromes in Sturmian words. In: De Felice, C., Restivo, A. (eds.) DLT 2005. LNCS, vol. 3572, pp. 199–208. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  27. 27.
    Manacher, G.: A new linear-time “On-Line” algorithm for finding the smallest initial palindrome of a string. Journal of the ACM 22(3), 346–351 (1975)CrossRefMATHGoogle Scholar
  28. 28.
    Matsubara, W., Inenaga, S., Ishino, A., Shinohara, A., Nakamura, T., Hashimoto, K.: Efficient algorithms to compute compressed longest common substrings and compressed palindromes. Theoretical Computer Science 410(8–10), 900–913 (2009)MathSciNetCrossRefMATHGoogle Scholar
  29. 29.
    Moore, D., Smyth, W.F., Miller, D.: Counting distinct strings. Algorithmica 23(1), 1–13 (1999)MathSciNetCrossRefMATHGoogle Scholar
  30. 30.
    Porto, A.H.L., Barbosa, V.C.: Finding approximate palindromes in strings. Pattern Recognition 35(11), 2581–2591 (2002)CrossRefMATHGoogle Scholar
  31. 31.
    Schürmann, K.B., Stoye, J.: Counting suffix arrays and strings. Theoretical Computer Science 395(2-1), 220–234 (2008)MathSciNetCrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Tomohiro I
    • 1
  • Shunsuke Inenaga
    • 2
  • Hideo Bannai
    • 1
  • Masayuki Takeda
    • 1
  1. 1.Department of InformaticsKyushu UniversityJapan
  2. 2.Graduate School of Information Science and Electrical EngineeringKyushu UniversityFukuokaJapan

Personalised recommendations