Question: P 1 ( LCS ) ( 1 0 pts ) Find the Longest Common Subsequence. ( 3 pts ) Fill in the table. Be careful:

P1(LCS)(10 pts) Find the Longest Common Subsequence.
(3 pts) Fill in the table. Be careful: one mistake in one cell can cause the remaining cells to be wrong. (3pts) Record the direction as well using the symbols: "" for diagonal, "-" for left, "|" for up. E.g."0-" in a cell means the value is 0 and the arrow is left.
Use the LCS_length (x,Y) pseudocode from the slides. Whenever there is a tie between left and up, chose up (this is consistent with LCS_length (x,Y)). Penalty for the wrong choice in case of a tie: 1 pt.
X=T R A Y
Y= S T O R M
(2 pts) LCS final answer: Length: Subsequence:
(2pt) Highlight the cells that you visit when recovering the longest common subsequence.
PSEUDOCODE:
LCSlength (x,Y)
N= length (x)
P= length (Y)
b=2D array ofN+1 rows, P+1 columns
C=2D array ofN+1 rows, P+1 columns
for i=0toN
c[i,0]=0
for j=0toP
c[0,j]=0
for i=1toN
for j=1toP
ifxi-1==yj-1
c[i,j]=c[i-1,j-1]+1
b[i,j]=1,?? diagonal
else ifc[i-1,j]zC[i,j-1]
c[i,j]=c[i-1,j]
b[i,j]=?????up arrow
else
c[i,j]=c[i,j-1]
b[i,j]=??left arrow
P 1 ( LCS ) ( 1 0 pts ) Find the Longest Common

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 Accounting Questions!