Skip to main content

Squares and Repetitions

1999; Kolpakov, Kucherov

  • Reference work entry
Encyclopedia of Algorithms

Keywords and Synonyms

Powers; Runs; Tandem repeats      

Problem Definition

Periodicities and repetitions in strings have been extensively studied and are important both in theory and practice (combinatorics of words, pattern‐matching, computational biology). The words of the type ww and www, where w is a nonempty primitive (not of the form u k for an integer \( { k > 1 } \)) word, are called squares and cubes, respectively. They are well‐investigated objects in combinatorics on words [16] and in string‐matching with small memory [5].

A string w is said to be periodic iff \( { period(w)\le |w|/2 } \), where period(w) is the smallest positive integer p for which \( { w[i]=w[i+p] } \) whenever both sides of the equality are defined. In particular each square and cube is periodic.

A repetition in a string \( { x = x_1 x_2 \dots x_n } \) is an interval \( { [i\mathinner{\ldotp\ldotp} j]\subseteq[1\mathinner{\ldotp\ldotp} n] } \) for which the associated factor \( { x[i\mathinner{\ldotp\ldotp} j]...

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 399.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Recommended Reading

  1. Apostolico, A., Preparata, F.P.: Optimal off-line detection of repetitions in a string. Theor. Comput. Sci. 22(3), 297–315 (1983)

    Article  MathSciNet  MATH  Google Scholar 

  2. Crochemore, M.: An optimal algorithm for computing the repetitions in a word. Inform. Process. Lett. 12(5), 244–250 (1981)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  4. Crochemore, M., Ilie, L.: Analysis of maximal repetitions in strings. J. Comput. Sci. (2007)

    Google Scholar 

  5. Crochemore, M., Rytter, W.: Squares, cubes, and time-space efficient string searching. Algorithmica 13(5), 405–425 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  6. Crochemore, M., Rytter, W.: Jewels of stringology. World Scientific, Singapore (2003)

    MATH  Google Scholar 

  7. Franek, F., Karaman, A., Smyth, W.F.: Repetitions in Sturmian strings. Theor. Comput. Sci. 249(2), 289–303 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  8. Fraenkel, A.S., Simpson, R.J.: How many squares can a string contain? J. Comb. Theory Ser. A 82, 112–120 (1998)

    Google Scholar 

  9. Fraenkel, A.S., Simpson, R.J.: The Exact Number of Squares in Fibonacci Words. Theor. Comput. Sci. 218(1), 95–106 (1999)

    Article  MathSciNet  MATH  Google Scholar 

  10. Franek, F., Simpson, R.J. , and Smyth, W.F.: The maximum number of runs in a string. In: Proc. 14-th Australian Workshop on Combinatorial Algorithms, pp. 26–35. Curtin University Press, Perth (2003)

    Google Scholar 

  11. Franek, F., Smyth, W.F., Tang, Y.: Computing all repeats using suffix arrays. J. Autom. Lang. Comb. 8(4), 579–591 (2003)

    MathSciNet  MATH  Google Scholar 

  12. Gusfield, D.and Stoye, J.: Linear time algorithms for finding and representing all the tandem repeats in a string. J. Comput. Syst. Sci. 69(4), 525–546 (2004)

    Article  Google Scholar 

  13. Ilie, L.: A simple proof that a word of length n has at most 2n distinct squares. J. Combin. Theory, Ser. A 112(1), 163–164 (2005)

    Google Scholar 

  14. Iliopoulos, C., Moore, D., Smyth, W.F.: A characterization of the squares in a Fibonacci string. Theor. Comput. Sci. 172 281–291 (1997)

    Google Scholar 

  15. Kolpakov, R., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: Proceedings of the 40th Symposium on Foundations of Computer Science, pp. 596–604. IEEE Computer Society Press, Los Alamitos (1999)

    Google Scholar 

  16. Lothaire, M. (ed.): Algebraic Combinatorics on Words. Cambridge University Press, Cambridge (2002)

    MATH  Google Scholar 

  17. Lothaire, M. (ed.): Applied Combinatorics on Words. Cambridge University Press, Cambridge (2005)

    MATH  Google Scholar 

  18. Main, M.G.: Detecting leftmost maximal periodicities. Discret. Appl. Math. 25, 145–153 (1989)

    Article  MathSciNet  MATH  Google Scholar 

  19. Main, M.G., Lorentz, R.J.: An \( { O(n \log n) } \) algorithm for finding all repetitions in a string. J. Algorithms 5(3), 422–432 (1984)

    Article  MathSciNet  MATH  Google Scholar 

  20. Rytter, W.: The structure of subword graphs and suffix trees of Fibonacci words. In: Implementation and Application of Automata, CIAA 2005. Lecture Notes in Computer Science, vol. 3845, pp. 250–261. Springer, Berlin (2006)

    Google Scholar 

  21. Rytter, W.: The Number of Runs in a String: Improved Analysis of the Linear Upper Bound. In: Proceedings of the 23rd Annual Symposium on Theoretical Aspects of Computer Science. Lecture Notes in Computer Science, vol. 3884, pp. 184–195. Springer, Berlin (2006)

    Google Scholar 

  22. Smyth, W.F.: Repetitive perhaps, but certainly not boring. Theor. Comput. Sci. 249(2), 343–355 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  23. Smyth, W.F.: Computing patterns in strings. Addison‐Wesley, Boston, MA (2003)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2008 Springer-Verlag

About this entry

Cite this entry

Crochemore, M., Rytter, W. (2008). Squares and Repetitions. In: Kao, MY. (eds) Encyclopedia of Algorithms. Springer, Boston, MA. https://doi.org/10.1007/978-0-387-30162-4_392

Download citation

Publish with us

Policies and ethics