International Workshop on Combinatorial Algorithms

IWOCA 2014: Combinatorial Algorithms pp 86-97 | Cite as

Computing Primitively-Rooted Squares and Runs in Partial Words

  • Francine Blanchet-SadriEmail author
  • Jordan Nikkel
  • J. D. Quigley
  • Xufan Zhang
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8986)


This paper deals with two types of repetitions in strings: squares, which consist of two adjacent occurrences of substrings, and runs, which are periodic substrings that cannot be extended further to the left or right. We show how to compute all the primitively-rooted squares in a given partial word, which is a sequence that may have undefined positions, called holes or wildcards, that match any letter of the alphabet over which the sequence is defined. We also describe an algorithm for computing all primitively-rooted runs in a given partial word.


  1. 1.
    Abrahamson, K.: Generalized string matching. SIAM J. Comput. 16(6), 1039–1051 (1987)zbMATHMathSciNetCrossRefGoogle Scholar
  2. 2.
    Apostolico, A., Preparata, F.P.: Optimal off-line detection of repetitions in a string. Theor. Comput. Sci. 22(3), 297–315 (1983)zbMATHMathSciNetCrossRefGoogle Scholar
  3. 3.
    Bach, E., Shallit, J.: Algorithmic Number Theory. Efficient Algorithms, vol. 1. MIT Press, Cambridge (1996) zbMATHGoogle Scholar
  4. 4.
    Blanchet-Sadri, F., Bodnar, M., Fox, N., Hidakatsu, J.: A graph polynomial approach to primitivity. In: Dediu, A.-H., Martín-Vide, C., Truthe, B. (eds.) LATA 2013. LNCS, vol. 7810, pp. 153–164. Springer, Heidelberg (2013) CrossRefGoogle Scholar
  5. 5.
    Blanchet-Sadri, F., Jiao, Y., Machacek, J.M., Quigley, J.D., Zhang, X.: Squares in partial words. Theor. Comput. Sci. 530, 42–57 (2014)zbMATHMathSciNetCrossRefGoogle Scholar
  6. 6.
    Blanchet-Sadri, F., Mercaş, R., Rashin, A., Willett, E.: Periodicity algorithms and a conjecture on overlaps in partial words. Theor. Comput. Sci. 443, 35–45 (2012)zbMATHCrossRefGoogle Scholar
  7. 7.
    Crochemore, M.: An optimal algorithm for computing the repetitions in a string. Inf. Process. Lett. 12(5), 244–250 (1981)zbMATHMathSciNetCrossRefGoogle Scholar
  8. 8.
    Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press, New York (2007) zbMATHCrossRefGoogle Scholar
  9. 9.
    Crochemore, M., Ilie, L., Rytter, W.: Repetitions in strings: Algorithms and combinatorics. Theor. Comput. Sci. 410, 5227–5235 (2009)zbMATHMathSciNetCrossRefGoogle Scholar
  10. 10.
    Diaconu, A., Manea, F., Tiseanu, C.: Combinatorial queries and updates on partial words. In: Kutyłowski, M., Charatonik, W., Gębala, M. (eds.) FCT 2009. LNCS, vol. 5699, pp. 96–108. Springer, Heidelberg (2009) CrossRefGoogle Scholar
  11. 11.
    Fischer, M., Paterson, M.: String matching and other products. In: Karp, R. (ed.) 7th SIAM-AMS Complexity of Computation, pp. 113–125 (1974)Google Scholar
  12. 12.
    Halava, V., Harju, T., Kärki, T.: On the number of squares in partial words. RAIRO-Theor. Inf. Appl. 44(1), 125–138 (2010)zbMATHCrossRefGoogle Scholar
  13. 13.
    Hardy, G.H., Wright, E.M.: An Introduction to the Theory of Numbers. Oxford University Press, London (2008) zbMATHGoogle Scholar
  14. 14.
    Kolpakov, R., Kucherov, G.: Finding maximal repetitions in a string in linear time. In: FOCS 1999, pp. 596–604. IEEE Computer Society Press, Los Alamitos (1999)Google Scholar
  15. 15.
    Lothaire, M.: Combinatorics on Words. Cambridge University Press, Cambridge (1997)zbMATHCrossRefGoogle Scholar
  16. 16.
    Main, M.G., Lorentz, R.J.: An O(nlog n) algorithm for finding all repetitions in a string. J. Algorithms 5(3), 422–432 (1984)zbMATHMathSciNetCrossRefGoogle Scholar
  17. 17.
    Manea, F., Mercaş, R., Tiseanu, C.: Periodicity algorithms for partial words. In: Murlak, F., Sankowski, P. (eds.) MFCS 2011. LNCS, vol. 6907, pp. 472–484. Springer, Heidelberg (2011) CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Francine Blanchet-Sadri
    • 1
    Email author
  • Jordan Nikkel
    • 2
  • J. D. Quigley
    • 3
  • Xufan Zhang
    • 4
  1. 1.Department of Computer ScienceUniversity of North CarolinaGreensboroUSA
  2. 2.Department of MathematicsVanderbilt UniversityNashvilleUSA
  3. 3.Department of MathematicsUniversity of Illinois - Urbana-ChampaignUrbanaUSA
  4. 4.Department of MathematicsPrinceton UniversityPrincetonUSA

Personalised recommendations