Skip to main content

Online Detection of Repetitions with Backtracking

  • Conference paper
  • First Online:
Combinatorial Pattern Matching (CPM 2015)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9133))

Included in the following conference series:

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.

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

References

  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)

    Article  MATH  MathSciNet  Google Scholar 

  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)

    Chapter  Google Scholar 

  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)

    Article  MATH  MathSciNet  Google Scholar 

  4. Crochemore, M.: Transducers and repetitions. Theor. Comput. Sci. 45, 63–86 (1986)

    Article  MATH  MathSciNet  Google Scholar 

  5. Galil, Z., Seiferas, J.: Time-space-optimal string matching. J. Comput. Syst. Sci. 26(3), 280–294 (1983)

    Article  MathSciNet  Google Scholar 

  6. Hong, J.J., Chen, G.H.: Efficient on-line repetition detection. Theor. Comput. Sci. 407(1), 554–563 (2008)

    Article  MATH  MathSciNet  Google Scholar 

  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)

    Chapter  Google Scholar 

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

    Chapter  Google Scholar 

  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)

    Chapter  Google Scholar 

  11. Shur, A.M.: Generating square-free words efficiently. Accepted to WORDS 2013 Special Issue of Theoretical Computer Science (2014)

    Google Scholar 

  12. Thue, A.: Ãœber unendliche zeichenreihen (1906). In: Selected Mathematical Papers of Axel Thue. Universitetsforlaget (1977)

    Google Scholar 

  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 

Download references

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

Authors

Corresponding author

Correspondence to Dmitry Kosolobov .

Editor information

Editors and Affiliations

Rights and permissions

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

Publish with us

Policies and ethics