Optimal Bounds for Computing \(\alpha \)-gapped Repeats

  • Maxime Crochemore
  • Roman Kolpakov
  • Gregory KucherovEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9618)


Following (Kolpakov et al., 2013; Gawrychowski and Manea, 2015), we continue the study of \(\alpha \) -gapped repeats in strings, defined as factors uvu with \(|uv|\le \alpha |u|\). Our main result is the \(O(\alpha n)\) bound on the number of maximal \(\alpha \)-gapped repeats in a string of length n, previously proved to be \(O(\alpha ^2 n)\) in (Kolpakov et al., 2013). For a closely related notion of maximal \(\delta \)-subrepetition (maximal factors of exponent between \(1+\delta \) and 2), our result implies the \(O(n/\delta )\) bound on their number, which improves the bound of (Kolpakov et al., 2010) by a \(\log n\) factor.

We also prove an algorithmic time bound \(O(\alpha n+S)\) (S size of the output) for computing all maximal \(\alpha \)-gapped repeats. Our solution, inspired by (Gawrychowski and Manea, 2015), is different from the recently published proof by (Tanimura et al., 2015) of the same bound. Together with our bound on S, this implies an \(O(\alpha n)\)-time algorithm for computing all maximal \(\alpha \)-gapped repeats.


Time Algorithm Maximal Repetition Output Size Interesting Open Question Identical Word 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Badkobeh, G., Crochemore, M., Toopsuwan, C.: Computing the maximal-exponent repeats of an overlap-free string in linear time. In: Calderón-Benavides, L., González-Caro, C., Chávez, E., Ziviani, N. (eds.) SPIRE 2012. LNCS, vol. 7608, pp. 61–72. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  2. 2.
    Bannai, H., Tomohiro, I., Inenaga, S., Nakashima, Y., Takeda, M., Tsuruta, K.: A new characterization of maximal repetitions by Lyndon trees, intermediate version presented to SODA’2015 (2014). CoRR abs/1406.0263
  3. 3.
    Breslauer, D.: Efficient string algorithmics. Ph.D. thesis, Columbia University (1992)Google Scholar
  4. 4.
    Brodal, G.S., Lyngs, R.B., Pedersen, C.N.S., Stoye, J.: Finding maximal pairs withbounded gap. J. Discrete Algorithms 1(1), 77–104 (2000)MathSciNetGoogle Scholar
  5. 5.
    Crochemore, M.: An optimal algorithm for computing the repetitions in a word. Inf. Process. Lett. 12(5), 244–250 (1981)CrossRefMathSciNetzbMATHGoogle Scholar
  6. 6.
    Crochemore, M., Ilie, L., Tinta, L.: Towards a solution to the “Runs” conjecture. In: Ferragina, P., Landau, G.M. (eds.) CPM 2008. LNCS, vol. 5029, pp. 290–302. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  7. 7.
    Crochemore, M., Iliopoulos, C., Kubica, M., Radoszewski, J., Rytter, W., Waleń, T.: Extracting powers and periods in a string from its runs structure. In: Chavez, E., Lonardi, S. (eds.) SPIRE 2010. LNCS, vol. 6393, pp. 258–269. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  8. 8.
    Crochemore, M., Kolpakov, R., Kucherov, G.: Optimal searching of gapped repeats in a word (2015). CoRR abs/1509.01221
  9. 9.
    Crochemore, M., Kubica, M., Radoszewski, J., Rytter, W., Walen, T.: On the maximal sum of exponents of runs in a string. J. Discrete Algorithms 14, 29–36 (2012)CrossRefMathSciNetzbMATHGoogle Scholar
  10. 10.
    Crochemore, M., Rytter, W.: Sqares, cubes, and time-space efficient string searching. Algorithmica 13(5), 405–425 (1995)CrossRefMathSciNetzbMATHGoogle Scholar
  11. 11.
    Dumitran, M., Manea, F.: Longest gapped repeats and palindromes. In: Italiano, G.F., Pighizzini, G., Sannella, D.T. (eds.) MFCS 2015. LNCS, vol. 9234, pp. 205–217. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  12. 12.
    Fischer, J., Holub, S., Tomohiro, I., Lewenstein, M.: Beyond the runs theorem. CoRR abs/1502.04644 (2015)
  13. 13.
    Galil, Z., Seiferas, J.I.: Time-space-optimal string matching. J. Comput. Syst. Sci. 26(3), 280–294 (1983)CrossRefMathSciNetGoogle Scholar
  14. 14.
    Gawrychowski, P.I.T., Inenaga, S., Köppl, D., Manea, F.: Efficiently finding all maximal \(\alpha \)-gapped repeats. CoRR abs/1509.09237 (2015)
  15. 15.
    Gawrychowski, P., Manea, F.: Longest \(\alpha \)-gapped repeat and palindrome. In: Kosowski, A., Walukiewicz, I. (eds.) FCT 2015. LNCS, vol. 9210, pp. 27–40. Springer, Heidelberg (2015)Google Scholar
  16. 16.
    Gusfield, D.: Algorithms on Strings, Trees, and Sequences - Computer Science and Computational Biology. Cambridge University Press, New York (1997)CrossRefzbMATHGoogle Scholar
  17. 17.
    Kolpakov, R.: On primary and secondary repetitions in words. Theor. Comput. Sci. 418, 71–81 (2012)CrossRefMathSciNetzbMATHGoogle Scholar
  18. 18.
    Kolpakov, R., Kucherov, G.: On maximal repetitions in words. J. Discrete Algorithms 1(1), 159–186 (2000)MathSciNetGoogle Scholar
  19. 19.
    Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. Theor. Comput. Sci. 410(51), 5365–5373 (2009)CrossRefMathSciNetzbMATHGoogle Scholar
  20. 20.
    Kolpakov, R., Kucherov, G., Ochem, P.: On maximal repetitions of arbitrary exponent. Inf. Process. Lett. 110(7), 252–256 (2010)CrossRefMathSciNetzbMATHGoogle Scholar
  21. 21.
    Kolpakov, R., Podolskiy, M., Posypkin, M., Khrapov, N.: Searching of gapped repeats and subrepetitions in a word. In: Kulikov, A.S., Kuznetsov, S.O., Pevzner, P. (eds.) CPM 2014. LNCS, vol. 8486, pp. 212–221. Springer, Heidelberg (2014)Google Scholar
  22. 22.
    Kolpakov, R.M., Kucherov, G.: Finding repeats with fixed gap. In: SPIRE, pp. 162–168 (2000)Google Scholar
  23. 23.
    Kosolobov, D.: Lempel-Ziv factorization may be harder than computing all runs. In: Mayr, E.W., Ollinger, N. (eds.) 32nd International Symposium on Theoretical Aspects of Computer Science, STACS 4–7, 2015, Garching, Germany. LIPIcs, vol. 30, pp. 582–593. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, March 2015Google Scholar
  24. 24.
    Lothaire, M.: Combinatorics on Words. Addison Wesley, Reading (1983)zbMATHGoogle Scholar
  25. 25.
    Main, M., Lorentz, R.: An \(O(n \log n)\) algorithm for finding all repetitions in a string. J. Algorithms 5(3), 422–432 (1984)CrossRefMathSciNetzbMATHGoogle Scholar
  26. 26.
    Storer, J.A.: Data Compression: Methods and Theory. Computer Science Press, Rockville (1988)Google Scholar
  27. 27.
    Tanimura, Y., Fujishige, Y., I, T., Inenaga, S., Bannai, H., Takeda, M.: A faster algorithm for computing maximal \(\alpha \)-gapped repeats in a string. In: Iliopoulos, C., Puglisi, S., Yilmaz, E. (eds.) SPIRE 2015. LNCS, vol. 9309, pp. 124–136. Springer, Heidelberg (2015)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Maxime Crochemore
    • 1
  • Roman Kolpakov
    • 2
  • Gregory Kucherov
    • 3
    Email author
  1. 1.King’s College LondonLondonUK
  2. 2.Lomonosov Moscow State UniversityMoscowRussia
  3. 3.LIGM/CNRS, Université Paris-EstMarne-la-valléeFrance

Personalised recommendations