Detecting Regularities on Grammar-Compressed Strings

  • Tomohiro I
  • Wataru Matsubara
  • Kouji Shimohira
  • Shunsuke Inenaga
  • Hideo Bannai
  • Masayuki Takeda
  • Kazuyuki Narisawa
  • Ayumi Shinohara
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8087)

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.

Keywords

Dition 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)MathSciNetCrossRefMATHGoogle Scholar
  2. 2.
    Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163–173 (1995)MathSciNetCrossRefMATHGoogle Scholar
  3. 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. 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. 5.
    Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and combinatorics. Theor. Comput. Sci. 410(50), 5227–5235 (2009)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Crochemore, M., Rytter, W.: Efficient parallel algorithms to test square-freeness and factorize strings. Information Processing Letters 38(2), 57–60 (1991)MathSciNetCrossRefMATHGoogle Scholar
  7. 7.
    Jansson, J., Peng, Z.: Online and dynamic recognition of squarefree strings. International Journal of Foundations of Computer Science 18(2), 401–414 (2007)MathSciNetCrossRefMATHGoogle Scholar
  8. 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. 9.
    Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)MathSciNetCrossRefMATHGoogle Scholar
  10. 10.
    Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: FOCS, pp. 596–604 (1999)Google Scholar
  11. 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)CrossRefGoogle Scholar
  12. 12.
    Main, M.G.: Detecting leftmost maximal periodicities. Discrete Applied Mathematics 25(1-2), 145–153 (1989)MathSciNetCrossRefMATHGoogle Scholar
  13. 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)MathSciNetCrossRefMATHGoogle Scholar
  14. 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)CrossRefMATHGoogle Scholar
  15. 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)MathSciNetCrossRefMATHGoogle Scholar
  16. 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)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Tomohiro I
    • 1
    • 2
  • Wataru Matsubara
    • 3
  • Kouji Shimohira
    • 1
  • Shunsuke Inenaga
    • 1
  • Hideo Bannai
    • 1
  • Masayuki Takeda
    • 1
  • Kazuyuki Narisawa
    • 3
  • Ayumi Shinohara
    • 3
  1. 1.Department of InformaticsKyushu UniversityJapan
  2. 2.Japan Society for the Promotion of Science (JSPS)Japan
  3. 3.Graduate School of Information SciencesTohoku UniversityJapan

Personalised recommendations