Maximum Number of Distinct and Nonequivalent Nonstandard Squares in a Word

  • Tomasz Kociumaka
  • Jakub Radoszewski
  • Wojciech Rytter
  • Tomasz Waleń
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8633)


The combinatorics of squares in a word depends on how the equivalence of halves of the square is defined. We consider Abelian squares, parameterized squares and order-preserving squares. The word uv is an Abelian (parameterized, order-preserving) square if u and v are equivalent in the Abelian (parameterized, order-preserving) sense. The maximum number of ordinary squares is known to be asymptotically linear, but the exact bound is still investigated. We present several results on the maximum number of distinct squares for nonstandard subword equivalence relations. Let SQ Abel(n,k) and SQAbel(n,k) denote the maximum number of Abelian squares in a word of length n over an alphabet of size k, which are distinct as words and which are nonequivalent in the Abelian sense, respectively. We prove that SQ Abel(n,2) = Θ(n 2) and SQAbel(n,2) = Ω(n 1.5/logn). We also give linear bounds for parameterized and order-preserving squares for small alphabets: SQ param(n,2) = Θ(n) and SQ op(n,O(1)) = Θ(n). As a side result we construct infinite words over the smallest alphabet which avoid nontrivial order-preserving squares and nontrivial parameterized cubes (nontrivial parameterized squares cannot be avoided in an infinite word).


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baker, B.S.: Parameterized pattern matching: Algorithms and applications. Journal of Computer and System Sciences 52(1), 28–42 (1996)CrossRefzbMATHMathSciNetGoogle Scholar
  2. 2.
    Berstel, J., Karhumäki, J.: Combinatorics on words: A tutorial. Bulletin of the EATCS 79, 178–228 (2003)zbMATHGoogle Scholar
  3. 3.
    Blanchet-Sadri, F., Jiao, Y., Machacek, J.M., Quigley, J., Zhang, X.: Squares in partial words. Theoretical Computer Science 530, 42–57 (2014)CrossRefzbMATHMathSciNetGoogle Scholar
  4. 4.
    Blanchet-Sadri, F., Merca, R., Scott, G.: Counting distinct squares in partial words. Acta Cybernetica 19(2), 465–477 (2009)zbMATHMathSciNetGoogle Scholar
  5. 5.
    Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and combinatorics. Theoretical Computer Science 410(50), 5227–5235 (2009)CrossRefzbMATHMathSciNetGoogle Scholar
  6. 6.
    Crochemore, M., et al.: Order-preserving incomplete suffix trees and order-preserving indexes. In: Kurland, O., Lewenstein, M., Porat, E. (eds.) SPIRE 2013. LNCS, vol. 8214, pp. 84–95. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  7. 7.
    Crochemore, M., Iliopoulos, C.S., Kociumaka, T., Kubica, M., Radoszewski, J., Rytter, W., Tyczyński, W., Waleń, T.: The maximum number of squares in a tree. In: Kärkkäinen, J., Stoye, J. (eds.) CPM 2012. LNCS, vol. 7354, pp. 27–40. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  8. 8.
    Crochemore, M., Iliopoulos, C.S., Kubica, M., Radoszewski, J., Rytter, W., Waleń, T.: Extracting powers and periods in a word from its runs structure. Theoretical Computer Science 521, 29–41 (2014)CrossRefzbMATHMathSciNetGoogle Scholar
  9. 9.
    Erdős, P.: An asymptotic inequality in the theory of numbers (in Russian). Vestnik Leningrad University: Mathematics 15, 41–49 (1960)MathSciNetGoogle Scholar
  10. 10.
    Erdős, P.: Some unsolved problems, Hungarian Academy of Sciences Mat. Kutató Intézet Közl. 6, 221–254 (1961)Google Scholar
  11. 11.
    Evdokimov, A.A.: Strongly asymmetric sequences generated by a finite number of symbols. Doklady Akademii Nauk SSSR 179(6), 1268–1271 (1968)MathSciNetGoogle Scholar
  12. 12.
    Fici, G.: Personal communicationGoogle Scholar
  13. 13.
    Fici, G., Langiu, A., Lecroq, T., Lefebvre, A., Mignosi, F., Prieur-Gaston, É.: Abelian repetitions in Sturmian words. In: Béal, M.-P., Carton, O. (eds.) DLT 2013. LNCS, vol. 7907, pp. 227–238. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  14. 14.
    Fraenkel, A.S., Simpson, J.: How many squares can a string contain? Journal of Combinatorial Theory, Series A 82, 112–120 (1998)CrossRefzbMATHMathSciNetGoogle Scholar
  15. 15.
    Gusfield, D., Stoye, J.: Linear time algorithms for finding and representing all the tandem repeats in a string. Journal of Computer and System Sciences 69(4), 525–546 (2004)CrossRefzbMATHMathSciNetGoogle Scholar
  16. 16.
    Hardy, G., Wright, E., Heath-Brown, D., Silverman, J.: An Introduction to the Theory of Numbers. Oxford mathematics. OUP, Oxford (2008)zbMATHGoogle Scholar
  17. 17.
    Huova, M., Karhumäki, J., Saarela, A.: Problems in between words and abelian words: k-abelian avoidability. Theor. Comput. Sci. 454, 172–177 (2012)CrossRefzbMATHGoogle Scholar
  18. 18.
    Ilie, L.: A simple proof that a word of length n has at most 2n distinct squares. Journal of Combinatorial Theory, Series A 112(1), 163–164 (2005)CrossRefzbMATHMathSciNetGoogle Scholar
  19. 19.
    Ilie, L.: A note on the number of squares in a word. Theoretical Computer Science 380(3), 373–376 (2007)CrossRefzbMATHMathSciNetGoogle Scholar
  20. 20.
    Keränen, V.: Abelian squares are avoidable on 4 letters. In: Kuich, W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 41–52. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  21. 21.
    Muthukrishnan, S.: New results and open problems related to non-standard stringology. In: Galil, Z., Ukkonen, E. (eds.) CPM 1995. LNCS, vol. 937, pp. 298–317. Springer, Heidelberg (1995)CrossRefGoogle Scholar
  22. 22.
    Muthukrishnan, S., Palem, K.: Non-standard stringology: Algorithms and complexity. In: Proceedings of the Twenty-sixth Annual ACM Symposium on Theory of Computing, STOC 1994, pp. 770–779. ACM, New York (1994)CrossRefGoogle Scholar
  23. 23.
    Pleasants, P.A.: Non-repetitive sequences. Mathematical Proceedings of the Cambridge Philosophical Society 68, 267–274 (1970)CrossRefzbMATHMathSciNetGoogle Scholar
  24. 24.
    Thue, A.: Über unendliche Zeichenreihen. Norske Videnskabers Selskabs Skrifter Mat.-Nat. Kl. 7, 1–22 (1906)Google Scholar
  25. 25.
    Thue, A.: Über die gegenseitige Lage gleicher Teile gewisser Zeichenreihen. Norske Videnskabers Selskabs Skrifter Mat.-Nat. Kl. 10, 1–67 (1912)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Tomasz Kociumaka
    • 1
  • Jakub Radoszewski
    • 1
  • Wojciech Rytter
    • 1
    • 2
  • Tomasz Waleń
    • 1
  1. 1.Faculty of Mathematics, Informatics and MechanicsUniversity of WarsawWarsawPoland
  2. 2.Faculty of Mathematics and Computer ScienceCopernicus UniversityToruńPoland

Personalised recommendations