Question

The following table is partially filled. 0 1 4 0 Xi 4 D a) Explain why c[1,1] to c[1,5] and c[2,1] to c[5,1] are all 1s? b) CQuestion 2 (2.5 points) Longest common subsequence Consider the procedure to determine the length of the longest common subse

The following table is partially filled. 0 1 4 0 Xi 4 D a) Explain why c[1,1] to c[1,5] and c[2,1] to c[5,1] are all 1s? b) Compute c[2,2], and which cell do you refer to when computing it? c) Compute c 2,31 and c[3,2], which cell do you refer to directly this time? d) Fill up the rest of the cells. Assume that you take c[i,j - 1] when there is a draw in line 11. (i.e., take the first element.)
Question 2 (2.5 points) Longest common subsequence Consider the procedure to determine the length of the longest common subsequence, LCS- LENGTH(X, Y). It solves the LCS problem in a bottom-up manner, by filling out a 2-D tabular. LCS-LENGTH(X, Y) m-X. length n = Y.length 3. let c[O..m, 0..n] be a new array 4. for i-0 to m 5. for j 0 to n cli,j] = 0 c[i,j]-c[i-i,j-1] + 1 cli, j]-max(c[i, j-1 ], c[i-1, j]) 7. 8. 9. 10. else if X[i]Yl else 12. return c[m, n] For example, X - (B, C, B, D, C) and Y - (B, C, A, B, C), because the last two elements are the same (C), we have LCS(X,Y) LCS(X1:4,h4) + 1. If we represent LCS(X,Y) with the table entry c[5,5], then c[5,5]-c[4,4] +1. Here, c[4,4] is the solution to the subproblem: LCS of (B,C,B,D) and (B,C,A,B). The following table is partially filled.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

20 cend both a komfelement 一ーーキャem.. -Lar( onel eoe C) ond bork-ro Aem anar ome aapel aliaanal

1. because in starting we got the match B = B and we add 1 from the previous diagonal element. and by conditions we are taking max of the previous elements.

2. a[2,2] is 2. its come from the diagonal element a[1,1} and add 1 to it. so we get the answer 2

3.a[2,3] = 2 come from the previous a[2,2] because it is maximum one while comparing.

and a[3,2] = 2 come from the previous a[2,2] because it is maximum one while comparing.

both condition i mentioned in the given image.

4. 20 cend both a komf

Add a comment
Know the answer?
Add Answer to:
The following table is partially filled. 0 1 4 0 Xi 4 D a) Explain why c[1,1] to c[1,5] and c[2,1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 2 (2.5 points) Longest common subsequence Consider the procedure to determine the length...

    Question 2 (2.5 points) Longest common subsequence Consider the procedure to determine the length of the longest common subsequence, LCS- LENGTH(X, Y). It solves the LCS problem in a bottom-up manner, by filling out a 2-D tabular LCS-LENGTH(X, Y) m = X.length 2. n-Y.length 3. let cO.m, 0n] be a new array 4, for i = 0 to m for/ = 0 to n else if ATY ci,ci ,j-1 +1 10 else 12. return clm, n] For example, X (B,...

  • Questions 33 to 35 refer to the following Longest Common Subsequence problem. Given two sequences X-XI,...

    Questions 33 to 35 refer to the following Longest Common Subsequence problem. Given two sequences X-XI, X2,..., ...., X and Y y, y......... ya. Let C[ij]be the length of Longest Common Subsequence of x1, x2,..., Xi and y, y,..... Then Cij] can be recursively defined as following: CO if i=0 or j = 0 Cli,j][i-1.j-1]+1 ifi.j> 0 and x = y, max{C[i-1.7].[1.j-1); if i j>0 and x*y 0 The following is an incomplete table for sequence of AATGTT and AGCT....

  • 0 The water tank is shown below. It is partially filled with water ydiagram not to scae Length He...

    y is the original height of the cylinder 0 The water tank is shown below. It is partially filled with water ydiagram not to scae Length Height Width (d) Calculate the value of y when x 2.4m (e) State what the value of x and the value of y represent for this water (0 Find the value of x when the height of water in the tank is 0.9m. The water tank has a length of 5m. (B) When the...

  • explain option C ,D Let A, B, C and D be the following 4 x 4...

    explain option C ,D Let A, B, C and D be the following 4 x 4 binary matrices. 1 10 1 0 0 1 0 A= 10 0 1 0 0 0 0 B AT where cij= a4-i+1 j where d -4y] = a; 4-j+1 D = Match the following binary images to the given matrices A, B, C and D. No malch n Let A, B, C and D be the following 4 x 4 binary matrices. 1 10...

  • Need help with all 3 parts. Thanks Question 1 (Longest Common Subsequence) In the longest common...

    Need help with all 3 parts. Thanks Question 1 (Longest Common Subsequence) In the longest common sub- sequence algorithm we discussed in class, we formulated the recursive formula based on prefixes of the two inputs, i.e., X[1...) and Y [1..,]. 1. Rewrite the recursive formula using suffixes instead of prefixes, i.e., X[...m] and Y[j..n]. 2. Develop a bottom-up dynamic programming algorithm based on the recur- sive formula in (a). Describe the algorithm and write a pseudo code. 3. Use the...

  • Please explain the python code below L1 = [2, 15, 'Carol', 7.4, 0, -10, -6, 42,...

    Please explain the python code below L1 = [2, 15, 'Carol', 7.4, 0, -10, -6, 42, 27, -1, 2.0, 'hello', [2, 4], 23] print("L1 =",L1) odds =[] evens=[] list=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',',','.'] no=0 for i in L1: i=str(i) for j in list: if i.find(j)>=0: no=1 if no==1: None else: i=int(i) if i%2==0: evens.append(i) else: odds.append(i) no=0      ...

  • why is this wrong for vectors vector<char> decrypt{ {'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',...

    why is this wrong for vectors vector<char> decrypt{ {'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A'}, {'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B'}, }; for(int...

  • Please explain why 1010???? and also why c can be represent in that way? please draw table error...

    please explain why 1010???? and also why c can be represent in that way? please draw table error code 9:07 No SIM For an integer n greater than or equal to 0, a code g that associates it with a 4-bit code word g (n) is obtained as shown on the right, but it is assumed that the following condition is satisfied 10001 2 0011 3 0010 0110 5 0111 6 0101 7 0100 8 1100, 9 1101 . For...

  • HOMEWORK6 CS425.docx - Word REVIEW VIEW Foxit PDF REFERENCES MAILINGS АавbccDt Аавьсах АавьсАавьссс Аав 1 Normal...

    HOMEWORK6 CS425.docx - Word REVIEW VIEW Foxit PDF REFERENCES MAILINGS АавbccDt Аавьсах АавьсАавьссс Аав 1 Normal 1 No Spac... Heading 1 Heading 2 Title A. E E B Paragraph Styles 2. Using the Dynamic Programming concept, determine the Binomial coefficients using n = 7 and k Determine the values of C(5,3), 17, 2) and (6,3) from the table constructed. 3. Find the optimal order, and its cost, for evaluating the product of A, XA, XA, XA XA Where the sizes...

  • Consider the following specification: {n>0 and for all ij (0 <i<n and 0 sj<n and i...

    Consider the following specification: {n>0 and for all ij (0 <i<n and 0 sj<n and i j) implies z[i #z[j]} myproc(n: IN integer; 0: UPDATE float array of maximum n elements; m:OUT integer) {t=(Ezi)n (i=0,2..n-1)) and (m en) and (for all i ((0in and 'z[i] < t) implies (exists j (0 sjmand z[j] = "z[i]))) and (for all i ((0si<n and 'z[i] > t) implies (not exists j (0 jmandzij] = "z[i])))} Which of the following segments of code in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT