Detour: Finding a Longest Common Subsequence
Let’s find the longest common subsequence by using a different technique.
We'll cover the following...
The other way of finding LCS
Define the i-prefix of a string as the substring formed by its first i letters and the j-suffix of a string as the substring formed by its final j letters. Also, given strings and , let LCS denote an LCS between the i-prefix of and the j-prefix of , and let be the length of LCS.
By definition, = = 0 for all values of i and j. Next, LCS ...