Longest Common Subsequence

The longest common subsequence (LCS) problem is the problem of finding the longest subsequence common to all sequences in a set of sequences (often just two sequences).

Parameters

  • nn: length of the longer input string
  • mm: length of the shorter input string
  • rr: length of the LCS
  • ss: size of the alphabet
  • pp: the number of dominant matches (AKA number of minimal candidates), i.e. the total number of ordered pairs of positions at which the two sequences match

Filters

Computational Model

Randomization

Approximation

Algorithms Table

Displaying 15 of 15 algorithms

See more
Rick (Algorithm 2)1995O(sn+min(r(nr),rm))O(sn + \min(r(n - r), rm))O(sn+p)O(sn + p)
Rick (Section 4)1995O(sn+min(sp,rm))O(sn + \min(sp, rm))O(sn+p)O(sn + p)
Chin and Poon1991O(sn+min(sp,rm))O(sn + \min(sp, rm))O(p+n)O(p + n)
Wu et al.1990O(n(mr))O(n(m-r))O(m2)O(m^2)
Kuo and Cross1989O(p+n(r+logn))O(p + n(r+\log n))O(p+n)O(p + n)
Apostolico and Guerra (HS1 Algorithm)1987O(mlogn+plog(2mn/p))O(m \log n +p \log(2mn/p))O(p+n)O(p + n)
Apostolico and Guerra (Algorithm 2)1987O(rm+sn+nlogs)O(rm + sn + n \log s)O(p+sn)O(p + sn)
Miller and Myers1985O(n(mr))O(n(m-r))O(m2)O(m^2)
Hsu and Du (Scheme 2)1984O(rmlog(n/r)+rm)O(rm \log(n/r) + rm)O(rm)O(rm)
Hsu and Du (Scheme 1)1984O(rmlog(n/m)+rm)O(rm \log(n/m) + rm)O(rm)O(rm)
Nakatsu et al.1982O(n(mr))O(n(m-r))O(m2)O(m^2)
Mukhopadhyay1980O((n+p)logn)O((n + p) \log n)O(p+n)O(p + n)
Hunt and Szymanski1977O((n+p)logn)O((n + p) \log n)O(p+n)O(p + n)
Hirschberg1977O(rn+nlogn)O(rn + n \log n)O(n+p)O(n + p)
Wagner and Fischer1974O(mn)O(mn)O(mn)O(mn)

Reductions Table

Displaying 2 of 2 reductions

Other relevant algorithms

Insuffient Data to display table