English

Sublinear Space Algorithms for the Longest Common Substring Problem

Data Structures and Algorithms 2014-07-03 v1

Abstract

Given mm documents of total length nn, we consider the problem of finding a longest string common to at least d2d \geq 2 of the documents. This problem is known as the \emph{longest common substring (LCS) problem} and has a classic O(n)O(n) space and O(n)O(n) time solution (Weiner [FOCS'73], Hui [CPM'92]). However, the use of linear space is impractical in many applications. In this paper we show that for any trade-off parameter 1τn1 \leq \tau \leq n, the LCS problem can be solved in O(τ)O(\tau) space and O(n2/τ)O(n^2/\tau) time, thus providing the first smooth deterministic time-space trade-off from constant to linear space. The result uses a new and very simple algorithm, which computes a τ\tau-additive approximation to the LCS in O(n2/τ)O(n^2/\tau) time and O(1)O(1) space. We also show a time-space trade-off lower bound for deterministic branching programs, which implies that any deterministic RAM algorithm solving the LCS problem on documents from a sufficiently large alphabet in O(τ)O(\tau) space must use Ω(nlog(n/(τlogn))/loglog(n/(τlogn))\Omega(n\sqrt{\log(n/(\tau\log n))/\log\log(n/(\tau\log n)}) time.

Keywords

Cite

@article{arxiv.1407.0522,
  title  = {Sublinear Space Algorithms for the Longest Common Substring Problem},
  author = {Tomasz Kociumaka and Tatiana Starikovskaya and Hjalte Wedel Vildhøj},
  journal= {arXiv preprint arXiv:1407.0522},
  year   = {2014}
}

Comments

Accepted to 22nd European Symposium on Algorithms

R2 v1 2026-06-22T04:53:17.579Z