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

 Given two strings X-Xi . x2 , . . . ,

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!