Abstract
In this paper we present two algorithms for the following problem: given a string and a rational \(e > 1\), detect in the online fashion the earliest occurrence of a repetition of exponent \(\ge e\) in the string.
1. The first algorithm supports the backtrack operation removing the last letter of the input string. This solution runs in \(O(n\log m)\) time and \(O(m)\) space, where \(m\) is the maximal length of a string generated during the execution of a given sequence of \(n\) read and backtrack operations.
2. The second algorithm works in \(O(n\log \sigma )\) time and \(O(n)\) space, where \(n\) is the length of the input string and \(\sigma \) is the number of distinct letters. This algorithm is relatively simple and requires much less memory than the previously known solution with the same working time and space.
Keywords
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Apostolico, A., Breslauer, D.: An optimal \(O(\log \log n)\)-time parallel algorithm for detecting all squares in a string. SIAM J. Comput. 25(6), 1318–1331 (1996)
Breslauer, D., Grossi, R., Mignosi, F.: Simple real-time constant-space string matching. In: Giancarlo, R., Manzini, G. (eds.) CPM 2011. LNCS, vol. 6661, pp. 173–183. Springer, Heidelberg (2011)
Breslauer, D., Italiano, G.F.: Near real-time suffix tree construction via the fringe marked ancestor problem. J. Discrete Algorithms 18, 32–48 (2013)
Crochemore, M.: Transducers and repetitions. Theor. Comput. Sci. 45, 63–86 (1986)
Galil, Z., Seiferas, J.: Time-space-optimal string matching. J. Comput. Syst. Sci. 26(3), 280–294 (1983)
Hong, J.J., Chen, G.H.: Efficient on-line repetition detection. Theor. Comput. Sci. 407(1), 554–563 (2008)
Jansson, J., Peng, Z.: Online and dynamic recognition of squarefree strings. In: Jedrzejowicz, J., Szepietowski, A. (eds.) MFCS 2005. LNCS, vol. 3618, pp. 520–531. Springer, Heidelberg (2005)
Kosolobov, D.: Lempel-Ziv factorization may be harder than computing all runs. In: 32nd International Symposium on Theoretical Aspects of Computer Science (STACS 2015). Leibniz International Proceedings in Informatics (LIPIcs), vol. 30, pp. 582–593. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik (2015)
Leung, H., Peng, Z., Ting, H.-F.: An efficient online algorithm for square detection. In: Chwa, K.-Y., Munro, J.I. (eds.) COCOON 2004. LNCS, vol. 3106, pp. 432–439. Springer, Heidelberg (2004)
Main, M.G., Lorentz, R.J.: Linear time recognition of squarefree strings. In: Apostolico, A., Galil, Z. (eds.) Combinatorial Algorithms on Words, pp. 271–278. Springer, Heidelberg (1985)
Shur, A.M.: Generating square-free words efficiently. Accepted to WORDS 2013 Special Issue of Theoretical Computer Science (2014)
Thue, A.: Über unendliche zeichenreihen (1906). In: Selected Mathematical Papers of Axel Thue. Universitetsforlaget (1977)
Weiner, P.: Linear pattern matching algorithms. In: IEEE Conference Record of 14th Annual Symposium on Switching and Automata Theory, SWAT 2008, pp. 1–11. IEEE (1973)
Acknowledgement
The author would like to thank Arseny M. Shur for the help in the preparation of this paper and Gregory Kucherov for stimulating discussions.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this paper
Cite this paper
Kosolobov, D. (2015). Online Detection of Repetitions with Backtracking. In: Cicalese, F., Porat, E., Vaccaro, U. (eds) Combinatorial Pattern Matching. CPM 2015. Lecture Notes in Computer Science(), vol 9133. Springer, Cham. https://doi.org/10.1007/978-3-319-19929-0_25
Download citation
DOI: https://doi.org/10.1007/978-3-319-19929-0_25
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-19928-3
Online ISBN: 978-3-319-19929-0
eBook Packages: Computer ScienceComputer Science (R0)