Abstract

The longest common subsequence (LCS) problem is a classic computer science problem. For the essential problem of computing LCS between two arbitrary sequences s1 and s2, this paper proposes an algorithm taking O(n+r) space and O(r+n2) time, where r is the total number of elements in the set (i,j)|s1[i]=s2[j]. The algorithm can be more efficient than relevant classical algorithms in specific ranges of r.

Highlights

  • The longest common subsequence (LCS) problem is a classic computer science problem and still attracts continuous attention [1,2,3,4]

  • For the essential problem of computing LCS between two arbitrary sequences s1 and s2, this paper proposes an algorithm taking O(n + r) space and O(r + n2) time, where r is the total number of elements in the set {(i, j)|s1[i] = s2[j]}

  • It is the basis of data comparison programs and widely used by revision control systems for reconciling multiple changes made to a revision-controlled collection of files

Read more

Summary

Introduction

The longest common subsequence (LCS) problem is a classic computer science problem and still attracts continuous attention [1,2,3,4]. Compared with Chvatal-Sankoff algorithm [10], Hirschberg algorithm [11], and Hunt-Szymanski algorithm [15], most of the other algorithms for LCS problem between two sequences have more dependency, such as the following: the length of LCS is estimable beforehand [13, 14], two input sequences are similar [14, 16], problem is sparse enough [17], or the alphabet size is finite [16, 18, 20]. An algorithm of O(n + r) space and O(r + n2) time is proposed for LCS2, where r is the total number of elements in the set {(i, j)|s1[i] = s2[j]} assuming the two arbitrary sequences are s1 and s2.

Algorithm
Efficiency
Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call