Faster Space-Efficient STR-IC-LCS Computation
Abstract: 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-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 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((\ell+1)(n-\ell+1))$ space, where $\ell$ is the length of an LCS of $A$ and $B$ of length $n$. When $\ell = O(1)$ or $n-\ell = O(1)$, then this algorithm uses only linear $O(n)$ space. Second, we present a faster algorithm that works in $O(nr/\log{r}+n(n-\ell+1))$ time, where $r$ is the length of $P$, while retaining the $O((\ell+1)(n-\ell+1))$ space efficiency. Third, we give an alternative algorithm that runs in $O(nr/\log{r}+n(n-\ell'+1))$ time with $O((\ell'+1)(n-\ell'+1))$ space, where $\ell'$ denotes the STR-IC-LCS length for input strings $A$, $B$, and $P$.
- Tight hardness results for LCS and other sequence similarity measures. In FOCS 2015, pages 59–78, 2015.
- P. Bille and M. Farach-Colton. Fast and compact regular expression matching. Theor. Comput. Sci., 409(3):486–496, 2008.
- The fine-grained complexity of episode matching. In CPM 2022, volume 223 of LIPIcs, pages 4:1–4:12, 2022.
- On the generalized constrained longest common subsequence problems. Journal of Combinatorial Optimization, 21(3):383–392, Apr 2011.
- A simple algorithm for the constrained sequence problems. Information Processing Letters, 90(4):175 – 179, 2004.
- Episode matching. In CPM 1997, pages 12–27. Springer, 1997.
- S. Deorowicz. Quadratic-time algorithm for a string constrained lcs problem. Information Processing Letters, 112(11):423 – 426, 2012.
- D. S. Hirschberg. A linear space algorithm for computing maximal common subsequences. Communications of the ACM, 18(6):341––343, 1975.
- Faster STR-IC-LCS computation via RLE. In CPM 2017, pages 20:1–20:12, 2017.
- Constrained Longest Common Subsequences with Run-Length-Encoded Strings. The Computer Journal, 58(5):1074–1084, 2014.
- W. J. Masek and M. Paterson. A faster algorithm computing string edit distances. J. Comput. Syst. Sci., 20(1):18–31, 1980.
- A longest common subsequence algorithm suitable for similar text strings. Acta Inf., 18:171–179, 1982.
- Y.-T. Tsai. The constrained longest common subsequence problem. Information Processing Letters, 88(4):173 – 176, 2003.
- The string-to-string correction problem. J. ACM, 21(1):168–173, Jan. 1974.
- Faster STR-EC-LCS computation. In SOFSEM 2020, volume 12011 of Lecture Notes in Computer Science, pages 125–135. Springer, 2020.
- Space-efficient STR-IC-LCS computation. In SOFSEM 2023, volume 13878 of Lecture Notes in Computer Science, pages 372–384. Springer, 2023.
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.