Space-Efficient STR-IC-LCS Computation
One of the most fundamental method for comparing two given strings A and B is the longest common subsequence (LCS), where the task is to find (the length) of the longest common subsequence. In this paper, we address the STR-IC-LCS problem which is one of the constrained LCS problems proposed by Chen and Chao [J. Comb. Optim, 2011]. A string Z is said to be an STR-IC-LCS of three given strings A, B, and P, if Z is one of the longest common subsequences of A and B that contains P as a substring. We present a space efficient solution for the STR-IC-LCS problem. Our algorithm computes the length of an STR-IC-LCS in O(n^2) time and O((ℓ+1)(n-ℓ+1)) space where ℓ is the length of a longest common subsequence of A and B of length n. When ℓ = O(1) or n-ℓ = O(1), then our algorithm uses only linear O(n) space.
READ FULL TEXT