Advertisement

Online Detection of Repetitions with Backtracking

  • Dmitry KosolobovEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9133)

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

Repetition-free Square-free Online algorithm Backtracking 

Notes

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.

References

  1. 1.
    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)zbMATHMathSciNetCrossRefGoogle Scholar
  2. 2.
    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) CrossRefGoogle Scholar
  3. 3.
    Breslauer, D., Italiano, G.F.: Near real-time suffix tree construction via the fringe marked ancestor problem. J. Discrete Algorithms 18, 32–48 (2013)zbMATHMathSciNetCrossRefGoogle Scholar
  4. 4.
    Crochemore, M.: Transducers and repetitions. Theor. Comput. Sci. 45, 63–86 (1986)zbMATHMathSciNetCrossRefGoogle Scholar
  5. 5.
    Galil, Z., Seiferas, J.: Time-space-optimal string matching. J. Comput. Syst. Sci. 26(3), 280–294 (1983)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Hong, J.J., Chen, G.H.: Efficient on-line repetition detection. Theor. Comput. Sci. 407(1), 554–563 (2008)zbMATHMathSciNetCrossRefGoogle Scholar
  7. 7.
    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) CrossRefGoogle Scholar
  8. 8.
    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)Google Scholar
  9. 9.
    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) CrossRefGoogle Scholar
  10. 10.
    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)CrossRefGoogle Scholar
  11. 11.
    Shur, A.M.: Generating square-free words efficiently. Accepted to WORDS 2013 Special Issue of Theoretical Computer Science (2014)Google Scholar
  12. 12.
    Thue, A.: Über unendliche zeichenreihen (1906). In: Selected Mathematical Papers of Axel Thue. Universitetsforlaget (1977)Google Scholar
  13. 13.
    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)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  1. 1.Ural Federal UniversityEkaterinburgRussia

Personalised recommendations