This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: e. How to reconstruct actual list of words Keep backpointers For any j with T[j] = true, let B[j] = position at which last word begins Actually outputting the words S = empty stack J = n While j > 0 : Push(x[b[jk]], s) J = B[j] 1 While s != 0 Output pops 2. Longest common subsequence a. Ex. Two sequences A, C, T, G, C, T, A, G G, T, G, A, C, A, G, T, T Common subsequence GT, AGT Longest = GGCAG or TGCAG b. Given two sequences X[1n] And Y[1m] Find the length of their LCS. c. Step 1: subproblem For 1 <= i <= n, 1 <= j <= m, T(I, j) = length of LCS of x[1i] and y[1. .j] Step 2: express subproblem in terms of smaller subproblems T(I, j) = 1 + T(i-1, j-1) if x[i] = y[j] Max(T(i-1,j, T(I,j-1)) d....
View Full Document