Polynomial-time equivalences and refined algorithms for longest common subsequence variants - Asahiro, Yuichi; Jansson, Jesper; Lin, Guohui; Miyano, Eiji; Ono, Hirotaka; Utashima, Tadatoshi (Discrete Applied Mathematics, 2024)
The problem of computing the longest common subsequence of two sequences (LCS for short) is a classical and fundamental problem in computer science. In this article, we study four variants of LCS: the Repetition-Bounded Longest Common Subsequence problem (RBLCS), the Multiset-Restricted Common Subsequence problem (MRCS), the Two-Side-Filled Longest Common Subsequence problem (2FLCS), and the One-Side-Filled Longest Common Subsequence problem (1FLCS). Although the original LCS can be solved in polynomial time, all these four variants are known to be NP-hard. Recently, an exact, O(1.44225n)-time, dynamic programming (DP) based algorithm for RBLCS was proposed, where the two input sequences have lengths n and poly(n). Here, we first establish that each of MRCS, 1FLCS, and 2FLCS is polynomially equivalent to RBLCS. Then, we design a refined DP-based algorithm for RBLCS that runs in O(1.41422n) time, which implies that MRCS, 1FLCS, and 2FLCS can also be solved in O(1.41422n) time. Finally, we give a polynomial-time 2-approximation algorithm for 2FLCS.