We investigate a variant of the longest com-mon subsequence problem. Given two sequences X, Y and two constrained patterns P , Q of lengths m, n, p, and q, respectively, the hybrid con-strained longest common subsequence problem is to find a longest common subsequence of X and Y such that the resulting LCS is both a superse-quence of P and a nonsupersequence of Q. With-out loss of generality,
... [Show full abstract] assume that m ≤ n. We present a new dynamic programming algorithm for solving this problem in O(mnpq) time and space. We also propose another algorithm by restricting the computation on the positions of matches be-tween X and Y . The latter algorithm requires O(pqr log log n + n log n) time over an infinite al-phabet and O((pqr+n) log log n)) time over a finite alphabet, and O(pq(r + n)) space for both cases, where r denotes the total number of matches be-tween X and Y .