13.07.2015 Views

New Efficient Algorithms for LCS and Constrained LCS Problem

New Efficient Algorithms for LCS and Constrained LCS Problem

New Efficient Algorithms for LCS and Constrained LCS Problem

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

⎧Undefined if (i, j) /∈ M,⎪⎨1 if (i = 1 or j = 1) <strong>and</strong> (i, j) ∈ MT [i, j] =1 + max 1≤li j) wemust have T [i ′ ][j] ≥ T [i][j] (resp. T [i][j ′ ] ≥ T [i][j]).Fact 2. ([24]) The calculation of a T [i][j], (i, j) ∈ M, 1 ≤ i, j ≤ n is independent ofany T [l][q], (l, q) ∈ M, l = i, 1 ≤ q ≤ n.Along with the above two facts, we use the ‘BoundedHeap’ data structure of [7] thatsupports the following operations:Insert(H, pos, val, data): Insert into the BoundedHeap H the position pos with valueval <strong>and</strong> associated in<strong>for</strong>mation data.IncreaseV alue(H, pos, val, data): If H does not already contain the position pos,per<strong>for</strong>m Insert(H, pos, val, data). Otherwise, set this position’s value to max{val, val ′ },where val ′ is its previous value. Also, change the ‘data’ field accordingly.BoundedMax(H, pos): Return the item (with additional data) that has maximumvalue among all items in H with position smaller than pos. If H does not containany items with position smaller than pos, return 0.The following theorem from [7] presents the time complexity of the BoundedHeapdata structure.Theorem 1. ([7]) BoundedHeap data structure can support each of the above operationsin O(log log n) amortized time, where keys are drawn from the set {1, . . . , n}.The data structure requires O(n) space.The algorithm Alg<strong>LCS</strong><strong>New</strong> proceeds as follows. Recall that we per<strong>for</strong>m a rowby row operation. We always deal with two BoundedHeap data structures. Whileconsidering row i, we already have the BoundedHeap data structure H i−1 at ourh<strong>and</strong>; now we construct the BoundedHeap data structure H i . At first H i is initialized2 In [24], the running time of this preprocessing step is reported as O(R log log n) under the usual assumptionthat R ≥ n.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!