1 Dynamic Programming Lcs Follow Code Determine Lcs Longest Common Subsequence 0 1 0 1 1 0 Q37248281

1. Dynamic Programming for lcs

a)Follow the code below to determine an LCS(Longest commonsubsequence) of<1,0,0,1,0,1,0,1> and < 0,1,0,1,1,0,1,1,0>. Please show the 2-D table c and b as being used in the pseudocode LCS length. Note the 2-D table b is set so that b[i,j] pointsto the table entry corresponding to the optimal subproblem solutionchosen when computing c[i,j].

b)Give pseudocode to reconstruct an LCS from the completed c tableand the original sequences X =< x1, x2, …, xm >, and Y=< y1, y2, …, yn > in O(m + n) time, without using the btable

LCS-LENGTH(X, Y) 1 m= X.length 2 n- Y.length 3 let b[1..m, 1..n] and c[0..m,0..n] be new tables 4 for i= l to m cli,0] = 0 0tLCS-LENGTH(X,

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.