Longest Common Extensions in Sublinear Space

  • Philip Bille
  • Inge Li Gørtz
  • Mathias Bæk Tejs Knudsen
  • Moshe Lewenstein
  • Hjalte Wedel VildhøjEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9133)


The longest common extension problem (LCE problem) is to construct a data structure for an input string \(T\) of length \(n\) that supports \({\mathrm {LCE}}(i,j)\) queries. Such a query returns the length of the longest common prefix of the suffixes starting at positions \(i\) and \(j\) in \(T\). This classic problem has a well-known solution that uses \(\mathcal {O}(n)\) space and \(\mathcal {O}(1)\) query time. In this paper we show that for any trade-off parameter \(1 \le \tau \le n\), the problem can be solved in \(\mathcal {O}(\frac{n}{\tau })\) space and \(\mathcal {O}(\tau )\) query time. This significantly improves the previously best known time-space trade-offs, and almost matches the best known time-space product lower bound.


Query Time Monte Carlo Algorithm Suffix Tree Input String Deterministic Solution 
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.
    Amir, A., Lewenstein, M., Porat, E.: Faster algorithms for string matching with k mismatches. J. Algorithms 50(2), 257–275 (2004)zbMATHMathSciNetCrossRefGoogle Scholar
  2. 2.
    Bille, P., Gørtz, I.L., Sach, B., Vildhøj, H.W.: Time-space trade-offs for longest common extensions. J. Discret. Algorithms 25, 42–50 (2014)zbMATHCrossRefGoogle Scholar
  3. 3.
    Bille, P., Gørtz, I.L., Knudsen, M.B.T., Lewenstein, M., Vildhøj, H.W.: Longest common extensions in sublinear space. arXiv:1504.02671(2015)
  4. 4.
    Cole, R., Hariharan, R.: Approximate string matching: a simpler faster algorithm. SIAM J. Comput. 31(6), 1761–1782 (2002)zbMATHMathSciNetCrossRefGoogle Scholar
  5. 5.
    Fine, N.J., Wilf, H.S.: Uniqueness theorems for periodic functions. Proc. AMS 16(1), 109–114 (1965)zbMATHMathSciNetCrossRefGoogle Scholar
  6. 6.
    Gusfield, D., Stoye, J.: Linear time algorithms for finding and representing all the tandem repeats in a string. J. Comput. Syst. Sci. 69, 525–546 (2004)zbMATHMathSciNetCrossRefGoogle Scholar
  7. 7.
    Harel, D., Tarjan, R.E.: Fast algorithms for finding nearest common ancestors. SIAM J. Comput. 13(2), 338–355 (1984)zbMATHMathSciNetCrossRefGoogle Scholar
  8. 8.
    Kärkkäinen, T.I J., Kempa, D.: Faster sparse suffix sorting. In: Proceedings of 31st STACS, vol. 25, pp. 386–396, Dagstuhl, Germany (2014)Google Scholar
  9. 9.
    Karp, R.M., Rabin, M.O.: Efficient randomized pattern-matching algorithms. IBM J. Res. Dev. 31(2), 249–260 (1987)zbMATHMathSciNetCrossRefGoogle Scholar
  10. 10.
    Kolpakov, R., Kucherov, G.: Searching for gapped palindromes. In: Ferragina, P., Landau, G.M. (eds.) CPM 2008. LNCS, vol. 5029, pp. 18–30. Springer, Heidelberg (2008) CrossRefGoogle Scholar
  11. 11.
    Landau, G.M., Myers, E.W., Schmidt, J.P.: Incremental string comparison. SIAM J. Comput. 27(2), 557–582 (1998)zbMATHMathSciNetCrossRefGoogle Scholar
  12. 12.
    Landau, G.M., Schmidt, J.P.: An algorithm for approximate tandem repeats. J. Comput. Biol. 8(1), 1–18 (2001)CrossRefGoogle Scholar
  13. 13.
    Landau, G.M., Vishkin, U.: Fast parallel and serial approximate string matching. J. Algorithms 10, 157–169 (1989)zbMATHMathSciNetCrossRefGoogle Scholar
  14. 14.
    Main, M.G., Lorentz, R.J.: An O (n log n) algorithm for finding all repetitions in a string. J. Algorithms 5(3), 422–432 (1984)zbMATHMathSciNetCrossRefGoogle Scholar
  15. 15.
    Manacher, G.: A new linear-time “On-Line” algorithm for finding the smallest initial palindrome of a string. J. ACM 22(3), 346–351 (1975)zbMATHCrossRefGoogle Scholar
  16. 16.
    Myers, E.W.: An \(O(ND)\) difference algorithm and its variations. Algorithmica 1(2), 251–266 (1986)zbMATHMathSciNetCrossRefGoogle Scholar
  17. 17.
    Weiner, P.: Linear pattern matching algorithms. In: Proceedings of 14th FOCS (SWAT), pp. 1–11 (1973)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Philip Bille
    • 1
  • Inge Li Gørtz
    • 1
  • Mathias Bæk Tejs Knudsen
    • 2
  • Moshe Lewenstein
    • 3
  • Hjalte Wedel Vildhøj
    • 1
    Email author
  1. 1.Technical University of Denmark, DTU ComputeLyngbyDenmark
  2. 2.Department of Computer ScienceUniversity of CopenhagenCopenhagenDenmark
  3. 3.Bar Ilan UniversityRamat GanIsrael

Personalised recommendations