English

Subsequence Matching and LCS with Segment Number Constraints

Data Structures and Algorithms 2025-02-27 v3

Abstract

The longest common subsequence (LCS) is a fundamental problem in string processing which has numerous algorithmic studies, extensions, and applications. A sequence u1,,ufu_1, \ldots, u_f of ff strings s said to be an (ff-)segmentation of a string PP if P=u1ufP = u_1 \cdots u_f. Li et al. [BIBM 2022] proposed a new variant of the LCS problem for given strings T1,T2T_1, T_2 and an integer ff, which we hereby call the segmental LCS problem (SegLCS), of finding (the length of) a longest string PP that has an ff-segmentation which can be embedded into both T1T_1 and T2T_2. Li et al. [IJTCS-FAW 2024] gave a dynamic programming solution that solves SegLCS in O(fn1n2)O(fn_1n_2) time with O(fn1+n2)O(fn_1 + n_2) space, where n1=T1n_1 = |T_1|, n2=T2n_2 = |T_2|, and n1n2n_1 \le n_2. Recently, Banerjee et al. [ESA 2024] presented an algorithm which, for a constant f3f \geq 3, solves SegLCS in O~((n1n2)1(1/3)f2)\tilde{O}((n_1n_2)^{1-(1/3)^{f-2}}) time. In this paper, we deal with SegLCS as well as the problem of segmental subsequence pattern matching, SegE, that asks to determine whether a pattern PP of length mm has an ff-segmentation that can be embedded into a text TT of length nn. When f=1f = 1, this is equivalent to substring matching, and when f=Pf = |P|, this is equivalent to subsequence matching. Our focus in this article is the case of general values of ff, and our main contributions are threefold: (1) O((mn)1ϵ)O((mn)^{1-\epsilon})-time conditional lower bound for SegE under the strong exponential-time hypothesis (SETH), for any constant ϵ>0\epsilon > 0. (2) O(mn)O(mn)-time algorithm for SegE. (3) O(fn2(n1+1))O(fn_2(n_1 - \ell+1))-time algorithm for SegLCS where \ell is the solution length.

Keywords

Cite

@article{arxiv.2407.19796,
  title  = {Subsequence Matching and LCS with Segment Number Constraints},
  author = {Yuki Yonemoto and Takuya Mieno and Shunsuke Inenaga and Ryo Yoshinaka and Ayumi Shinohara},
  journal= {arXiv preprint arXiv:2407.19796},
  year   = {2025}
}
R2 v1 2026-06-28T17:56:32.667Z