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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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)
Apostolico, A., Breslauer, D., Galil, Z.: Parallel detection of all palindromes in a string. Theor. Comput. Sci. 141(1&2), 163–173 (1995)
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)
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)
Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and combinatorics. Theor. Comput. Sci. 410(50), 5227–5235 (2009)
Crochemore, M., Rytter, W.: Efficient parallel algorithms to test square-freeness and factorize strings. Information Processing Letters 38(2), 57–60 (1991)
Jansson, J., Peng, Z.: Online and dynamic recognition of squarefree strings. International Journal of Foundations of Computer Science 18(2), 401–414 (2007)
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)
Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)
Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: FOCS, pp. 596–604 (1999)
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)
Main, M.G.: Detecting leftmost maximal periodicities. Discrete Applied Mathematics 25(1-2), 145–153 (1989)
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)
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)
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)
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)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)