Skip to main content

Counting Palindromes in Substrings

  • Conference paper
  • First Online:
String Processing and Information Retrieval (SPIRE 2017)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10508))

Included in the following conference series:

Abstract

We propose a data structure and an online algorithm to report the number of distinct palindromes in any substring of an input string. Assume that the string S of length n arrives symbol-by-symbol and every symbol is followed by zero or more queries of the form “report the number of distinct palindromes in S[i..j]”. We use \(O(n\log n)\) total time to process the string plus \(O(\log n)\) time per query. The required space is \(O(n\log n)\) in general and O(n) in a natural particular case. As a simple application, we describe an algorithm reporting all palindromic rich substrings of an input string in \(O(n\log n)\) time and O(n) space.

This work was Partially supported by the grant 16-01-00795 of the Russian Foundation of Basic Research.

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 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Notes

  1. 1.

    Unfortunately, there is one more data structure with this name, see, e.g., Wikipedia.

  2. 2.

    By Fact 1, only \(l_1\) can be undefined; if so, we assume that \(\mathsf{add}(l_1,-1)\) is ignored.

References

  1. Bannai, H., Gagie, T., Inenaga, S., Kärkkäinen, J., Kempa, D., Piatkowski, M., Puglisi, S.J., Sugimoto, S.: Diverse palindromic factorization is NP-complete. In: Potapov, I. (ed.) DLT 2015. LNCS, vol. 9168, pp. 85–96. Springer, Cham (2015). doi:10.1007/978-3-319-21500-6_6

    Chapter  Google Scholar 

  2. Brlek, S., Hamel, S., Nivat, M., Reutenauer, C.: On the palindromic complexity of infinite words. Int. J. Found. Comput. Sci. 15(2), 293–306 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  3. Dietz, P.F.: Optimal algorithms for list indexing and subset rank. In: Dehne, F., Sack, J.-R., Santoro, N. (eds.) WADS 1989. LNCS, vol. 382, pp. 39–46. Springer, Heidelberg (1989). doi:10.1007/3-540-51542-9_5

    Chapter  Google Scholar 

  4. Driscoll, J.R., Sarnak, N., Sleator, D.D., Tarjan, R.E.: Making data structures persistent. J. Comput. Syst. Sci. 38(1), 86–124 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  5. Droubay, X., Justin, J., Pirillo, G.: Episturmian words and some constructions of de Luca and Rauzy. Theoret. Comput. Sci. 255, 539–553 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  6. Fenwick, P.M.: A new data structure for cumulative frequency tables. Soft. Pract. Experience 24(3), 327–336 (1994)

    Article  Google Scholar 

  7. Fici, G., Gagie, T., Kärkkäinen, J., Kempa, D.: A subquadratic algorithm for minimum palindromic factorization. J. Discrete Algorithms 28, 41–48 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  8. Fine, N.J., Wilf, H.S.: Uniqueness theorems for periodic functions. Proc. Am. Math. Soc. 16, 109–114 (1965)

    Article  MathSciNet  MATH  Google Scholar 

  9. Galil, Z.: Real-time algorithms for string-matching and palindrome recognition. In: Proceedings of 8th Annual ACM Symposium on Theory of Computing (STOC 1976), pp. 161–173. ACM, New York, USA (1976)

    Google Scholar 

  10. Galil, Z., Seiferas, J.: A linear-time on-line recognition algorithm for “Palstar”. J. ACM 25, 102–111 (1978)

    Article  MathSciNet  MATH  Google Scholar 

  11. Glen, A., Justin, J., Widmer, S., Zamboni, L.: Palindromic richness. Eur. J. Comb. 30(2), 510–531 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  12. Groult, R., Prieur, E., Richomme, G.: Counting distinct palindromes in a word in linear time. Inform. Process. Lett. 110, 908–912 (2010)

    Article  MathSciNet  MATH  Google Scholar 

  13. Guo, C., Shallit, J., Shur, A.M.: Palindromic rich words and run-length encodings. Inform. Process. Lett. 116(12), 735–738 (2016)

    Article  MathSciNet  MATH  Google Scholar 

  14. Tomohiro, I., Sugimoto, S., Inenaga, S., Bannai, H., Takeda, M.: Computing palindromic factorizations and palindromic covers on-line. In: Kulikov, A.S., Kuznetsov, S.O., Pevzner, P. (eds.) CPM 2014. LNCS, vol. 8486, pp. 150–161. Springer, Cham (2014). doi:10.1007/978-3-319-07566-2_16

  15. Knuth, D.E., Morris, J., Pratt, V.: Fast pattern matching in strings. SIAM J. Comput. 6, 323–350 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  16. Kosolobov, D., Rubinchik, M., Shur, A.M.: Finding distinct subpalindromes online. In: Proceedings of Prague Stringology Conference, PSC 2013, pp. 63–69. Czech Technical University in Prague (2013)

    Google Scholar 

  17. Kosolobov, D., Rubinchik, M., Shur, A.M.: Palk is linear recognizable online. In: Italiano, G.F., Margaria-Steffen, T., Pokorný, J., Quisquater, J.-J., Wattenhofer, R. (eds.) SOFSEM 2015. LNCS, vol. 8939, pp. 289–301. Springer, Heidelberg (2015). doi:10.1007/978-3-662-46078-8_24

    Google Scholar 

  18. Manacher, G.: A new linear-time on-line algorithm finding the smallest initial palindrome of a string. J. ACM 22(3), 346–351 (1975)

    Article  MATH  Google Scholar 

  19. Rubinchik, M., Shur, A.M.: EERTREE: an efficient data structure for processing palindromes in strings. In: Lipták, Z., Smyth, W.F. (eds.) IWOCA 2015. LNCS, vol. 9538, pp. 321–333. Springer, Cham (2016). doi:10.1007/978-3-319-29516-9_27

    Chapter  Google Scholar 

  20. Slisenko, A.: Recognition of palindromes by multihead Turing machines. In: Proceeding of the Steklov Institute of Mathematics, vol. 129, pp. 30–202 (1973). In Russian, English translation by Silverman, R.H., American Mathematical Society, Providence, R.I. (1976), 25–208

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Arseny M. Shur .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Rubinchik, M., Shur, A.M. (2017). Counting Palindromes in Substrings. In: Fici, G., Sciortino, M., Venturini, R. (eds) String Processing and Information Retrieval. SPIRE 2017. Lecture Notes in Computer Science(), vol 10508. Springer, Cham. https://doi.org/10.1007/978-3-319-67428-5_25

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-67428-5_25

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-67427-8

  • Online ISBN: 978-3-319-67428-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy