Question: Implement these two methods and call them from the main and print the return c. Pass X and Y as int [ ] x ={1,0,0,1,0,1,0,1}
Procedure LCS-Length(X,Y) m length X] n length[Y] for i: 0 to m do cli, 0] 0 for j 0 to n do c j] 0 for i 1 to m do for j 1 to n do if x[i] YU] then clij] c[i-1, j-1] +1 else if c i-1 cli i-11 then clij] cli-1 else cli c[ij-1] return c Procedure Print-L (c,X,Y,ij) 1 if i 0 orj 0 then return then nt- X,i-1 j-1) print Xlil else if cli-1, il> cli i-11 else Pring-LCS(c, xi,j-1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
