The backtracing algorithm requires the entire matrix to be saved in memory. The space complexity consequently increase to O(nm). Hirschberg [4] developed a more practical space-reduction method for solving dynamic programming problems that reduces the required space from O(nm) to O(m) (for m<n).
Proof:[3] (chapter 12) For any fixed position k' in T, there is an alignment of S and T consisting of an alignment of and followed by a disjoint alignment of and . By definition of V and Vr, the best alignment of the first type has value and the best alignment of the second type has value , so the combined alignment has value . since this argument holds for any k', it follows that .
Conversely, for an optimal alignment of S and T, let k'be the right-most position in T that is aligned with a character at or before position in S. Then the optimal alignment of S and T consists of an alignment of and followed by an alignment of and . Let the value of the first alignment be denoted p and the value of the second alignment be denoted q. Then p must be equal to , for if we could replace the alignment of and with the alignment of and that allows value . That would create an alignment of S and T whose value is larger than the claimed optimal. Hence, p = . By similar reasoning, . So . Having shown both sides of the inequality, we conclude that .