Need help with all 3 parts. Thanks
Solution:
The longest common subsequence (LCS) problem can be solved using a dynamic programming solution with the help of a recurrence relation. The longest common subsequence means the length of the maximum subsequence common between any given two strings X and Y.
(a)
=>Here LCS(n,m) represents the recursion function of the longest common subsequence between two strings X and Y of lengths n and m respectively.
Based on the conditions written at the right of the longest common subsequence functions we follow the result.Here max represents the maximum length out of LCS(n-1,m) and LCS(n,m-1).
=> Here xn and ym represent the string length at any given point.
(b)
Given is the pseudo-code of the algorithm. We follow two approaches to calculate the longest common subsequence value between two strings X and Y.
=>Two approaches are a bottom-up approach and a top-down approach. The result obtained in both approaches will be the same.
=>In the bottom-up approach we fill the table from bottom to the top manner and in a top-down approach, we fill the table from top to bottom manner.
(c)
Given X = {A, B, C, B, D, A, B} and Y= {B, D, C, A, B, A}
I have created a table using the bottom-up approach and the recurrence relation of the dynamic programming solutions.
=> The length of the longest common subsequence which is at the corner of the left-most upper corner.
=> I have drawn an arrow from down to upward direction which indicates matching characters.
=> The longest common subsequence is B, C, B, A which is common in both.
I have explained each and every step through images as well as statements.
Need help with all 3 parts. Thanks Question 1 (Longest Common Subsequence) In the longest common...
1. Write the algorithm pseudocode for the longest common subsequence problem using dynamic programming. What is its running time?
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, 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....
I already solved part A and I just need help with part B 1. Matrix Multiplication The product of two n xn matrices X and Y is a third n x n matrix 2 = XY, with entries 2 - 21; = xixYk x k=1 There are n’ entries to compute, each one at a cost of O(n). The formula implies an algorithm with O(nº) running time. For a long time this was widely believed to be the best running...
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...
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...
Suppose n activities apply for using a common resource. Activity ai (1 ≤ i ≤ n) has a starting time S[i] and a finish time F[i] such that 0 < S[i] < F[i]. Two activities ai and aj (1 ≤ i, j ≤ n) are compatible if intervals [S[i], F[i]) and [S[j], F[j]) do not overlap. We assume the activities have been sorted such that S [1] ≤ S [2] ≤ …≤ S[n]. (a) Design an O(n2) dynamic programming algorithm...
need help with all 3 parts of this question thanks! The four cases below all show a ball with a charge of -3q at the top right corner of a square. Then there is either one, two, or three additional charged balls, each ball located at a different corner of the square. Note that the electric potential is defined to be zero an infinite distance from the charges. For parts (b) and (c), use q-3.50 x 10-6 c, and L-40.0...
hi! I need help with this college level differential equations question. Please show all work and thank you. 3. We will next use matrix exponentials to find a fundamental matrix for the given system of DEs, (t) = P3(t) , P= (a) Letỉ(t) Ty(t), where Ț s a 2 2 constant matrix. Then, the system becomes = Dy, where D-T-1 PT. Find matrices T and D, such that D is a diagonal matrix. (Note that D and T are complex...
Please i need help with all parts of the questions, Thanks. 1. Jane's utility function defined over two goods r and y is U(x, y)y-a Her income is M and the prices of the two goods are pa and py. (a) Find the Marshallian demand curves. (b) Find the Hicksian demand curves. (c) Find the indirect utility function (d) Find the expenditure function (e) Determine the substitution and income effects for good r when ini- tially M = $100, pr-$10,...