Question: Given two strings X-Xi . x2 , . . . , xn and Y-y ,y,, . . . , ym, give a dynamic programming algorithm

Given two strings X-Xi . x2 , . . . , xn and Y-y ,y,, . . . , ym, give a dynamic programming algorithm to find the length k of the longest string Z- zi,...,zk where Z appears as a substring of X and as a subsequence of Y. Recall that a substring has consecutive elements For example, consider the following input Xa, b, d, b, a, b,f.g.d For this input, the answer is 4 since b,d, b, a is a substring of X and it is also a subsequence of Y. For sim- plicity, you can assume that al table entries use O(1) space. You do not need to output the actual substring, just its length. Assume that the size of the alphabet is constant
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
