English

Faster Space-Efficient STR-IC-LCS Computation

Data Structures and Algorithms 2024-05-21 v2

Abstract

One of the most fundamental method for comparing two given strings AA and BB is the longest common subsequence (LCS), where the task is to find (the length) of an LCS of AA and BB. 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 ZZ is said to be an STR-IC-LCS of three given strings AA, BB, and PP, if ZZ is a longest string satisfying that (1) ZZ includes PP as a substring and (2) ZZ is a common subsequence of AA and BB. 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)O(n^2) time and O((+1)(n+1))O((\ell+1)(n-\ell+1)) space, where \ell is the length of an LCS of AA and BB of length nn. When =O(1)\ell = O(1) or n=O(1)n-\ell = O(1), then this algorithm uses only linear O(n)O(n) space. Second, we present a faster algorithm that works in O(nr/logr+n(n+1))O(nr/\log{r}+n(n-\ell+1)) time, where rr is the length of PP, while retaining the O((+1)(n+1))O((\ell+1)(n-\ell+1)) space efficiency. Third, we give an alternative algorithm that runs in O(nr/logr+n(n+1))O(nr/\log{r}+n(n-\ell'+1)) time with O((+1)(n+1))O((\ell'+1)(n-\ell'+1)) space, where \ell' denotes the STR-IC-LCS length for input strings AA, BB, and PP.

Keywords

Cite

@article{arxiv.2210.07979,
  title  = {Faster Space-Efficient STR-IC-LCS Computation},
  author = {Yuki Yonemoto and Yuto Nakashima and Shunsuke Inenaga and Hideo Bannai},
  journal= {arXiv preprint arXiv:2210.07979},
  year   = {2024}
}

Comments

This is a full version of "Space-Efficient STR-IC-LCS Computation" presented at SOFSEM 2023

R2 v1 2026-06-28T03:40:24.650Z