English

Faster STR-EC-LCS Computation

Data Structures and Algorithms 2020-01-17 v1

Abstract

The longest common subsequence (LCS) problem is a central problem in stringology that finds the longest common subsequence of given two strings AA and BB. More recently, a set of four constrained LCS problems (called generalized constrained LCS problem) were proposed by Chen and Chao [J. Comb. Optim, 2011]. In this paper, we consider the substring-excluding constrained LCS (STR-EC-LCS) problem. A string ZZ is said to be an STR-EC-LCS of two given strings AA and BB excluding PP if, ZZ is one of the longest common subsequences of AA and BB that does not contain PP as a substring. Wang et al. proposed a dynamic programming solution which computes an STR-EC-LCS in O(mnr)O(mnr) time and space where m=A,n=B,r=Pm = |A|, n = |B|, r = |P| [Inf. Process. Lett., 2013]. In this paper, we show a new solution for the STR-EC-LCS problem. Our algorithm computes an STR-EC-LCS in O(nΣ+(L+1)(mL+1)r)O(n|\Sigma| + (L+1)(m-L+1)r) time where Σmin{m,n}|\Sigma| \leq \min\{m, n\} denotes the set of distinct characters occurring in both AA and BB, and LL is the length of the STR-EC-LCS. This algorithm is faster than the O(mnr)O(mnr)-time algorithm for short/long STR-EC-LCS (namely, LO(1)L \in O(1) or mLO(1)m-L \in O(1)), and is at least as efficient as the O(mnr)O(mnr)-time algorithm for all cases.

Keywords

Cite

@article{arxiv.2001.05671,
  title  = {Faster STR-EC-LCS Computation},
  author = {Kohei Yamada and Yuto Nakashima and Shunsuke Inenaga and Hideo Bannai and Masayuki Takeda},
  journal= {arXiv preprint arXiv:2001.05671},
  year   = {2020}
}