Skip to main content

Linear Time Recognition of Squarefree Strings

  • Conference paper
Combinatorial Algorithms on Words

Part of the book series: NATO ASI Series ((NATO ASI F,volume 12))

Abstract

A square is an immediately repeated nonempty string, e.g., aa, abab, abcabc. This paper presents a new O(n log n) algorithm to determine whether a string of length n has a substring which is a square. The algorithm is not as general as some previous algorithms for finding all squares [1,7,8,13], but it does have a simplicity which the others lack. Also, for a fixed alphabet of size k, the algorithm can be improved by a factor of log k (n), yielding an O(n) algorithm for determining whether a string contains a square.

Research supported by the University of Colorado Council on Research and Creative Work.

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

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. Apostolico and F.P. Preparata, Optimal off-line detection of repetitions in a string, TCS 22 (1983) 297–315.

    Article  MathSciNet  MATH  Google Scholar 

  2. S.E. Arshon, Dokazatel’stov suscestvovanija n-znacnyh beskonecnyh asim-metricnyh posledovatel’nostei, Mat. Sb. 44 (1937), 769–779.

    Google Scholar 

  3. D.R. Bean, A. Ehrenfeucht and G.F. McNulty, Avoidable patterns in strings of symbols, Pacific J. Math., 85 (1979), 261–294.

    MathSciNet  MATH  Google Scholar 

  4. J. Berstel, Sur les mots sans carre definis par un morphisme, in Automata, Languages and Programming (A. Maurer, Ed.), LNCS 71, Springer-Verlag, Berlin, 1979, 16–25.

    Chapter  Google Scholar 

  5. J. Berstel, Mots sans carre et morphismes iters, Discrete Math. 29 (1979), 235–244.

    Article  MathSciNet  Google Scholar 

  6. C.H. Braunholtz, Solution to problem 5030, Am. Math. Mo. 70 (1963), 675–676.

    Article  MathSciNet  Google Scholar 

  7. M. Crochemore, Determination optimale des repetitions dans un mot, Technical Report 80–53, Laboratoire Informatique Theorique et Programmation, University of Paris (1981).

    Google Scholar 

  8. M. Crochemore, An optimal algorithm for computing repetitions in a word, IPL 12 (1981), 244–250.

    Article  MathSciNet  MATH  Google Scholar 

  9. A.A. Evdokimov, Strongly asymmetric sequences generated by a finite number of symbols, Soviet Math. Dokl., 9 (1968), 536–539.

    MATH  Google Scholar 

  10. D. Hawkins and W.E. Mientka, On sequences which contain no repetitions, Math. Student 24 (1956), 185–187. MR 19 (1958) #241.

    MathSciNet  Google Scholar 

  11. G.A. Hedlund, Remarks on the work of Axel Thue on sequences, Nord. Mat. Tidskr. 16 (1967), 148–150. MR 37 (1959), #4454.

    MathSciNet  Google Scholar 

  12. M.G. Main and R.J. Lorentz, An 0(nlogn) algorithm for recognizing repetition, Washington State University Technical Report CS-79–056, Pullman, WA 99164 (1979).

    Google Scholar 

  13. M.G. Main and R.J. Lorentz, An 0(n logn) algorithm for finding all repetitions in a string, J. of Algorithms, to appear (1984).

    Google Scholar 

  14. M. Morse, A solution of the problem of infinite play in chess, Bull. Amer. Math. Soc., 44 (1938), 632.

    MathSciNet  Google Scholar 

  15. M. Morse and G.A. Hedlund, Unending chess, symbolic dynamics and a problem in semigroups, Duke Math. J. 11 (1944), 1–7. MR 5 (1944) #202.

    Article  MathSciNet  Google Scholar 

  16. P.A.B. Pleasants, Nonrepetitive sequences, Proc. Cambridge Phil. Soc. 68 (1970), 267–274.

    Article  MathSciNet  MATH  Google Scholar 

  17. A. Thue, Uber unendliche Zeichenreihen. Norske Wdenskabers Selskabs Skrifter Mat.-Nat. Kl. (Kristiania) (1906), Nr. 7, 1–22.

    Google Scholar 

  18. A. Thue, Uber die gegenseitige Lage gleicher Teile gewisser Zeichenreihen, Norske Vlcienskabers Selskabs Skrifter Mat.-Nat. Kl. (Kristiania) (1912), Nr. 1, 1–67.

    Google Scholar 

  19. T. Zech, Wiederholungsfreie Folgen, Z. Angew. Math. Mech. 38 (1958), 206–209.

    Article  MathSciNet  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1985 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Main, M.G., Lorentz, R.J. (1985). Linear Time Recognition of Squarefree Strings. In: Apostolico, A., Galil, Z. (eds) Combinatorial Algorithms on Words. NATO ASI Series, vol 12. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-82456-2_18

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-82456-2_18

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-82458-6

  • Online ISBN: 978-3-642-82456-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics