Finding the gapped longest common subsequence by incremental suffix maximum queries ?
The longest common subsequence (LCS) problem with gap constraints (or the gapped LCS), which has applications to genetics and molecular biology, is an interesting and useful variant to the LCS problem. In previous work, this problem is solved in O(nm) O ( n m ) time when the gap constraints are fixed to a single integer, where n and m denote the lengths of the two input sequences A and B , respectively. In this paper, we first generalize the problem from fixed gaps to variable gap constraints. Then, we devise an optimal approach for the incremental suffix maximum query (ISMQ), which helps us obtain an efficient algorithm with O(nm) O ( n m ) time for finding LCS with variable gap constraints. In addition, our technique for ISMQ can be applied to solve one of the block edit problems on strings, reducing the time complexity from O ( n m log m + m 2 ) to O(nm+m2) O ( n m + m 2 ) . Hence, the result of this paper is beneficial to related research on sequence analysis and stringology.
longest common subsequence incremental suffix maximum query algorithm