Near-Optimal Computation of Runs over General Alphabet via Non-Crossing LCE Queries

  • Maxime CrochemoreEmail author
  • Costas S. Iliopoulos
  • Tomasz Kociumaka
  • Ritu Kundu
  • Solon P. Pissis
  • Jakub Radoszewski
  • Wojciech Rytter
  • Tomasz Waleń
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9954)


Longest common extension queries (LCE queries) and runs are ubiquitous in algorithmic stringology. Linear-time algorithms computing runs and preprocessing for constant-time LCE queries have been known for over a decade. However, these algorithms assume a linearly-sortable integer alphabet. A recent breakthrough paper by Bannai et al. (SODA 2015) showed a link between the two notions: all the runs in a string can be computed via a linear number of LCE queries. The first to consider these problems over a general ordered alphabet was Kosolobov (Inf. Process. Lett., 2016), who presented an \(\mathcal {O}(n (\log n)^{2/3})\)-time algorithm for answering \(\mathcal {O}(n)\) LCE queries. This result was improved by Gawrychowski et al. (CPM 2016) to \(\mathcal {O}(n \log \log n)\) time. In this work we note a special non-crossing property of LCE queries asked in the runs computation. We show that any n such non-crossing queries can be answered on-line in \(\mathcal {O}(n \alpha (n))\) time, where \(\alpha (n)\) is the inverse Ackermann function, which yields an \(\mathcal {O}(n \alpha (n))\)-time algorithm for computing runs.


Outerplanar Graph Suffix Array Similar Query Query Algorithm Membership Query 
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.
    Bannai, H., I, T., Inenaga, S., Nakashima, Y., Takeda, M., Tsuruta, K.: A new characterization of maximal repetitions by Lyndon trees. In: Indyk, P. (ed.) 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, pp. 562–571. SIAM (2015)Google Scholar
  2. 2.
    Bannai, H., I, T., Inenaga, S., Nakashima, Y., Takeda, M., Tsuruta, K.: The “runs” theorem (2015). arXiv:1406.0263v7
  3. 3.
    Barcelo, H.: On the action of the symmetric group on the free Lie algebra and the partition lattice. J. Comb. Theory, Ser. A 55(1), 93–129 (1990)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Brodal, G.S., Fagerberg, R.: Dynamic representations of sparse graphs. In: Dehne, F., Gupta, A., Sack, J.-R., Tamassia, R. (eds.) WADS 1999. LNCS, vol. 1663, pp. 342–351. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  5. 5.
    Crochemore, M., Hancart, C., Lecroq, T.: Algorithms on Strings. Cambridge University Press, New York (2007)CrossRefzbMATHGoogle Scholar
  6. 6.
    Crochemore, M., Ilie, L.: Analysis of maximal repetitions in strings. In: Kučera, L., Kučera, A. (eds.) MFCS 2007. LNCS, vol. 4708, pp. 465–476. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  7. 7.
    Crochemore, M., Ilie, L.: Maximal repetitions in strings. J. Comput. Syst. Sci. 74(5), 796–807 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    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
  9. 9.
    Crochemore, M., Iliopoulos, C.S., Kubica, M., Radoszewski, J., Rytter, W., Waleń, T.: Extracting powers and periods in a word from its runs structure. Theor. Comput. Sci. 521, 29–41 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Fischer, J., Holub, Š., I, T., Lewenstein, M.: Beyond the runs theorem. In: Iliopoulos, C., Puglisi, S., Yilmaz, E. (eds.) SPIRE 2015. LNCS, vol. 9309, pp. 277–286. Springer, Heidelberg (2015)CrossRefGoogle Scholar
  11. 11.
    Gawrychowski, P., Kociumaka, T., Rytter, W., Waleń, T.: Faster longest common extension queries in strings over general alphabets. In: Grossi, R., Lewenstein, M. (eds.) 27th Annual Symposium on Combinatorial Pattern Matching, CPM 2016. LIPIcs, vol. 54, pp. 5:1–5:13. Schloss Dagstuhl (2016)Google Scholar
  12. 12.
    Giraud, M.: Not so many runs in strings. In: Martín-Vide, C., Otto, F., Fernau, H. (eds.) LATA 2008. LNCS, vol. 5196, pp. 232–239. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  13. 13.
    Hohlweg, C., Reutenauer, C.: Lyndon words, permutations and trees. Theor. Comput. Sci. 307(1), 173–178 (2003)MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Kociumaka, T., Radoszewski, J., Rytter, W., Waleń, T.: Internal pattern matching queries in a text and applications. In: Indyk, P. (ed.) 26th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2015, pp. 532–551. SIAM (2015)Google Scholar
  15. 15.
    Kolpakov, R.M., Kucherov, G.: Finding maximal repetitions in a word in linear time. In: 40th Annual Symposium on Foundations of Computer Science, FOCS 1999, pp. 596–604. IEEE Computer Society (1999)Google Scholar
  16. 16.
    Kolpakov, R.M., Kucherov, G.: On maximal repetitions in words. J. Discrete Algorithms, 159–186. Special Issue of Matching Patterns, Hermes Science Publishing (2000).
  17. 17.
    Kosolobov, D.: Computing runs on a general alphabet. Inf. Process. Lett. 116(3), 241–244 (2016)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Nash-Williams, C.S.J.A.: Decompositions of finite graphs into forests. J. London Math. Soc. 39, 12 (1964)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Puglisi, S.J., Simpson, J., Smyth, W.F.: How many runs can a string contain? Theor. Comput. Sci. 401(1–3), 165–171 (2008)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Rytter, W.: The number of runs in a string: improved analysis of the linear upper bound. In: Durand, B., Thomas, W. (eds.) STACS 2006. LNCS, vol. 3884, pp. 184–195. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  21. 21.
    Rytter, W.: The number of runs in a string. Inf. Comput. 205(9), 1459–1469 (2007)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Maxime Crochemore
    • 1
    Email author
  • Costas S. Iliopoulos
    • 1
  • Tomasz Kociumaka
    • 2
  • Ritu Kundu
    • 1
  • Solon P. Pissis
    • 1
  • Jakub Radoszewski
    • 1
    • 2
  • Wojciech Rytter
    • 2
  • Tomasz Waleń
    • 2
  1. 1.Department of InformaticsKing’s College LondonLondonUK
  2. 2.Faculty of Mathematics, Informatics and MechanicsUniversity of WarsawWarsawPoland

Personalised recommendations