Finding Maximal 2-Dimensional Palindromes

Authors Sara Geizhals, Dina Sokol

Thumbnail PDF


  • Filesize: 0.96 MB
  • 12 pages

Document Identifiers

Author Details

Sara Geizhals
Dina Sokol

Cite AsGet BibTex

Sara Geizhals and Dina Sokol. Finding Maximal 2-Dimensional Palindromes. In 27th Annual Symposium on Combinatorial Pattern Matching (CPM 2016). Leibniz International Proceedings in Informatics (LIPIcs), Volume 54, pp. 19:1-19:12, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2016)


This paper extends the problem of palindrome searching into a higher dimension, addressing two definitions of 2D palindromes. The first definition implies a square, while the second definition (also known as a centrosymmetric factor), can be any rectangular shape. We describe two algorithms for searching a 2D text for maximal palindromes, one for each type of 2D palindrome. The first algorithm is optimal; it runs in linear time, on par with Manacher's linear time 1D palindrome algorithm. The second algorithm searches a text of size n_1 x n_2 (n_1 >= n_2) in O(n_2) time for each of its n_1 x n_2 positions. Since each position may have up to O(n_2) maximal palindromes centered at that location, the second result is also optimal in terms of the worst-case output size.
  • palindrome
  • pattern matching
  • 2-Dimensional
  • centrosymmetric factor


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Amihood Amir and Martin Farach. Two-dimensional Dictionary Matching. Information Processing Letters, 44(5):233-239, 1992. URL:
  2. Amihood Amir and Benny Porat. Approximate On-line Palindrome Recognition, and Applications. In number 8486 in Lecture Notes in Computer Science, pages 21-29. Springer International Publishing, 2014. URL:
  3. Alberto Apostolico, Dany Breslauer, and Zvi Galil. Optimal parallel algorithms for periods, palindromes and squares. In Automata, Languages and Programming, number 623 in Lecture Notes in Computer Science, pages 296-307. Springer Berlin Heidelberg, 1992. Google Scholar
  4. Alberto Apostolico, Dany Breslauer, and Zvi Galil. Parallel Detection of all Palindromes in a String. Comput. Sci, pages 497-506, 1994. Google Scholar
  5. Valérie Berthé and Laurent Vuillon. Palindromes and two-dimensional sturmian sequences. Journal of Automata, Languages and Combinatorics, 6(2):121-138, 2001. Google Scholar
  6. Kuan-Yu Chen, Ping-Hui Hsu, and Kun-Mao Chao. Efficient retrieval of approximate palindromes in a run-length encoded string. Theor. Comput. Sci., 432:28-37, 2012. Google Scholar
  7. F.G.B. De Natale, Daniele D. Giusto, and Fabrizio Maccioni. A symmetry-based approach to facial features extraction. In 1997 13th International Conference on Digital Signal Processing Proceedings, volume 2, pages 521-525, 1997. URL:
  8. Martin Farach. Optimal suffix tree construction with large alphabets. In Proceedings of the 38th Annual Symposium on Foundations of Computer Science, FOCS'97, pages 137-143. IEEE Computer Society, 1997. Google Scholar
  9. Johannes Fischer and Volker Heun. Space-Efficient Preprocessing Schemes for Range Minimum Queries on Static Arrays. SIAM Journal on Computing, 40(2):465-492, 2011. URL:
  10. fun-with words. History of Palindromes, 1999. URL:
  11. Zvi Galil and Joel Seiferas. A Linear-Time On-Line Recognition Algorithm for "Palstar". Journal of the ACM (JACM), 25(1):102-111, 1978. URL:
  12. Raffaele Giancarlo. A Generalization of the Suffix Tree to Square Matrices, with Applications. SIAM Journal on Computing, 24(3):520-562, 1995. URL:
  13. Dov Harel and Robert Endre Tarjan. Fast algorithms for finding nearest common ancestors. SIAM Journal on Computing, 13(2), 1984. Google Scholar
  14. Amit Hooda, Michael M. Bronstein, Alexander M. Bronstein, and Radu P. Horaud. Shape Palindromes: Analysis of Intrinsic Symmetries in 2d Articulated Shapes. In Lecture Notes in Computer Science, volume 6667, pages 665-676, Israel, 2012. Springer Berlin Heidelberg. URL:
  15. Ping-Hui Hsu, Kuan-Yu Chen, and Kun-Mao Chao. Finding All Approximate Gapped Palindromes. In Algorithms and Computation, number 5878 in Lecture Notes in Computer Science, pages 1084-1093. Springer Berlin Heidelberg, 2009. Google Scholar
  16. Tomohiro I, Shunsuke Inenaga, and Masayuki Takeda. Palindrome Pattern Matching. In Lecture Notes in Computer Science, pages 232-245. Springer Berlin Heidelberg, 2011. URL:
  17. Hwee Kim and Yo-Sub Han. Online Multiple Palindrome Pattern Matching. In String Processing and Information Retrieval, pages 173-178. Springer International Publishing, 2013. URL:
  18. Nahum Kiryati and Yossi Gofman. Detecting Symmetry in Grey Level Images: The Global Optimization Approach. International Journal of Computer Vision, 29(1):29-45, 1998. URL:
  19. Donald E. Knuth, James H. Morris, Jr., and Vaughan R. Pratt. Fast Pattern Matching in Strings. SIAM Journal on Computing, 6(2):323-350, 1977. URL:
  20. Roman Kolpakov and Gregory Kucherov. Searching for Gapped Palindromes. In Combinatorial Pattern Matching, number 5029 in Lecture Notes in Computer Science, pages 18-30. Springer Berlin Heidelberg, 2008. Google Scholar
  21. Glenn Manacher. A New Linear-Time On-Line Algorithm for Finding the Smallest Initial Palindrome of a String. J. ACM, 22(3):346-351, 1975. URL:
  22. Wataru Matsubara, Shunsuke Inenaga, Akira Ishino, Ayumi Shinohara, Tomoyuki Nakamura, and Kazuo Hashimoto. Efficient algorithms to compute compressed longest common substrings and compressed palindromes. Theor. Comput. Sci., 410(8-10):900-913, 2009. URL:
  23. Palindrome, 2015. URL:
  24. Sator Square, 2015. URL: