TY - JOUR
T1 - Faster space-efficient STR-IC-LCS computation
AU - Yonemoto, Yuki
AU - Nakashima, Yuto
AU - Inenaga, Shunsuke
AU - Bannai, Hideo
N1 - Publisher Copyright:
© 2024 Elsevier B.V.
PY - 2024/7/1
Y1 - 2024/7/1
N2 - 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 an LCS of A and B. In this paper, we deal with the STR-IC-LCS1 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 a longest string satisfying that (1) Z includes P as a substring and (2) Z is a common subsequence of A and B. We present three efficient algorithms for this problem: First, we begin with a space-efficient solution which computes the length of an STR-IC-LCS in O(n2) time and O((ℓ+1)(n−ℓ+1)) space, where ℓ is the length of an LCS of A and B of length n. When ℓ=O(1) or n−ℓ=O(1), then this algorithm uses only linear O(n) space. Second, we present a faster algorithm that works in O(nr/logr+n(n−ℓ+1)) time, where r is the length of P, while retaining the O((ℓ+1)(n−ℓ+1)) space efficiency. Third, we give an alternative algorithm that runs in O(nr/logr+n(n−ℓ′+1)) time with O((ℓ′+1)(n−ℓ′+1)) space, where ℓ′ denotes the STR-IC-LCS length for input strings A, B, and P.
AB - 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 an LCS of A and B. In this paper, we deal with the STR-IC-LCS1 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 a longest string satisfying that (1) Z includes P as a substring and (2) Z is a common subsequence of A and B. We present three efficient algorithms for this problem: First, we begin with a space-efficient solution which computes the length of an STR-IC-LCS in O(n2) time and O((ℓ+1)(n−ℓ+1)) space, where ℓ is the length of an LCS of A and B of length n. When ℓ=O(1) or n−ℓ=O(1), then this algorithm uses only linear O(n) space. Second, we present a faster algorithm that works in O(nr/logr+n(n−ℓ+1)) time, where r is the length of P, while retaining the O((ℓ+1)(n−ℓ+1)) space efficiency. Third, we give an alternative algorithm that runs in O(nr/logr+n(n−ℓ′+1)) time with O((ℓ′+1)(n−ℓ′+1)) space, where ℓ′ denotes the STR-IC-LCS length for input strings A, B, and P.
KW - Constrained longest common subsequence
KW - Dynamic programming
KW - String algorithms
UR - http://www.scopus.com/inward/record.url?scp=85192336748&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85192336748&partnerID=8YFLogxK
U2 - 10.1016/j.tcs.2024.114607
DO - 10.1016/j.tcs.2024.114607
M3 - Article
AN - SCOPUS:85192336748
SN - 0304-3975
VL - 1003
JO - Theoretical Computer Science
JF - Theoretical Computer Science
M1 - 114607
ER -