Skip to main content

Detecting Regularities on Grammar-Compressed Strings

  • Conference paper
Mathematical Foundations of Computer Science 2013 (MFCS 2013)

Abstract

We solve the problems of detecting and counting various forms of regularities in a string represented as a Straight Line Program (SLP). Given an SLP of size n that represents a string s of length N, our algorithm computes all runs and squares in s in O(n 3 h) time and O(n 2) space, where h is the height of the derivation tree of the SLP. We also show an algorithm to compute all gapped-palindromes in O(n 3 h + gnhlogN) time and O(n 2) space, where g is the length of the gap. The key technique of the above solution also allows us to compute the periods and covers of the string in O(n 2 h) time and O(nh(n + log2 N)) time, respectively.

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

Access this chapter

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Apostolico, A., Breslauer, D.: An optimal \(\mathcal{O}\) (log log N)-time parallel algorithm for detecting all squares in a string. SIAM Journal on Computing 25(6), 1318–1331 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  2. Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163–173 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  3. Bannai, H., Gagie, T., I, T., Inenaga, S., Landau, G.M., Lewenstein, M.: An efficient algorithm to test square-freeness of strings compressed by straight-line programs. Inf. Process. Lett. 112(19), 711–714 (2012)

    Google Scholar 

  4. Bille, P., Landau, G.M., Raman, R., Sadakane, K., Satti, S.R., Weimann, O.: Random access to grammar-compressed strings. In: Proc. SODA 2011, pp. 373–389 (2011)

    Google Scholar 

  5. Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and combinatorics. Theor. Comput. Sci. 410(50), 5227–5235 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  6. Crochemore, M., Rytter, W.: Efficient parallel algorithms to test square-freeness and factorize strings. Information Processing Letters 38(2), 57–60 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  7. Jansson, J., Peng, Z.: Online and dynamic recognition of squarefree strings. International Journal of Foundations of Computer Science 18(2), 401–414 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  8. Khvorost, L.: Computing all squares in compressed texts. In: Proceedings of the 2nd Russian Finnish Symposium on Discrete Mathemtics, vol. 17, pp. 116–122 (2012)

    Google Scholar 

  9. Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)

    Article  MathSciNet  MATH  Google Scholar 

  10. Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: FOCS, pp. 596–604 (1999)

    Google Scholar 

  11. Lifshits, Y.: Processing compressed texts: A tractability border. In: Ma, B., Zhang, K. (eds.) CPM 2007. LNCS, vol. 4580, pp. 228–240. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  12. Main, M.G.: Detecting leftmost maximal periodicities. Discrete Applied Mathematics 25(1-2), 145–153 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  13. Main, M.G., Lorentz, R.J.: An \(\mathcal{O}(n \log n)\) algorithm for finding all repetitions in a string. Journal of Algorithms 5(3), 422–432 (1984)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  16. Miyazaki, M., Shinohara, A., Takeda, M.: An improved pattern matching algorithm for strings in terms of straight-line programs. In: Hein, J., Apostolico, A. (eds.) CPM 1997. LNCS, vol. 1264, pp. 1–11. Springer, Heidelberg (1997)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2013 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

I, T. et al. (2013). Detecting Regularities on Grammar-Compressed Strings. In: Chatterjee, K., Sgall, J. (eds) Mathematical Foundations of Computer Science 2013. MFCS 2013. Lecture Notes in Computer Science, vol 8087. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-40313-2_51

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-40313-2_51

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-40312-5

  • Online ISBN: 978-3-642-40313-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics