next up previous
Next: Alignment Graph Up: Global Alignment in linear Previous: Global Alignment in linear

   
The Algorithm:

1.
Compute V(A, B) while saving the values of the ${{n}\over{2}}$-th row. Denote D(A,B) as the Forward Matrix F.
2.
Compute V(Ar, Br) while saving the ${{n}\over{2}}$-th row. Denote D(Ar, Br) as the Backward Matrix B.
3.
Find the column k* so that the crossing point ( ${{n}\over{2}}$, k*) satisfies:
$F({{n}\over{2}}, k^{*}) + B({{n}\over{2}}, m - k^{*}) = F(n,m)$
4.
Now that k* is found, recursively partition the problem to two sub problems:
(i) Find the path from (0,0) to ( ${{n}\over{2}}$, k*).
(ii) Find the path from (n, m) to ( ${{n}\over{2}}$, m - k*).

Lemma 2.11   Time complexity of Hirschberg's algorithm is O(nm).

Proof:Time complexity
Let T*(n,m) = Time to find the value of a $n\times{m}$ problem. Let T(n,m) = Time to find the path (solution) of a $n\times{m}$ problem.

 \begin{displaymath}
T^{*}(n,m) = 2T(n,m) + T^{*}({{n}\over{2}}, k^{*}) +
T^{*}({{n}\over{2}}, m - k^{*})
\end{displaymath} (2.1)

T(n,m)=cnm, therefore T*(n,m) = 4T(n,m) = 4cnm. according to 2.1: $4cnm = 2cnm + 4c({{n}\over{2}} \times k^{*})+4c({{n}\over{2}} \times (m-k^{*}))$. Therefore, the time complexity will remain O(nm).

Lemma 2.12   Space complexity of Hirschberg's algorithm is O(m)

Proof:Space Complexity
Each Dynamic Programming computation requires storing one additional row (middle one) which can be discarded once the middle point is found. Therefore the space complexity will be O(m).


next up previous
Next: Alignment Graph Up: Global Alignment in linear Previous: Global Alignment in linear
Itshack Pe`er
1999-01-03