Algorithms for computing variants of the longest common subsequence problem

  • Authors:
  • Costas S. Iliopoulos;M. Sohel Rahman

  • Affiliations:
  • Algorithm Design Group, Department of Computer Science, Kings College London, Strand, London WC2R 2LS, England, United Kingdom;Algorithm Design Group, Department of Computer Science, Kings College London, Strand, London WC2R 2LS, England, United Kingdom

  • Venue:
  • Theoretical Computer Science
  • Year:
  • 2008

Quantified Score

Hi-index 5.23

Visualization

Abstract

The longest common subsequence (LCS) problem is one of the classical and well-studied problems in computer science. The computation of the LCS is a frequent task in DNA sequence analysis, and has applications to genetics and molecular biology. In this paper we introduce new variants of LCS problem and present efficient algorithms to solve them. In particular we introduce the notion of gap constraints in the LCS problems. For the LCS problem with fixed gap, we first present a naive algorithm runs in O(n^2+R(K+1)^2) time, where R is the total number of ordered pairs of positions at which the two strings match and K is the fixed gap constraint. We then improve the running time to O(n^2+RK+Rloglogn) using some novel techniques. Furthermore, we present an algorithm that is independent of K and runs in O(n^2+Rloglogn) time. Using these techniques, we also present a new O(n^2) algorithm to solve the original LCS problem. Additionally, we modify our algorithms to handle elastic and rigid gaps. We also apply the notion of rigidness to the original LCS problem and modify the traditional dynamic programming solution to handle the rigidness presenting a O(n^2) algorithm to solve the problem. Finally, we also improve the solution to Rigid Fixed Gap LCS to O(n^2). Notably, in all of the above cases, we assume that the two given strings are of equal length i.e. n. But our results can be easily extended to handle two strings of different length.