



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















Yuanbo Zhu
Sequence in the development of a dynamic programming algorithm
Step 4 omitted if only the value of the best solutionsis required
dichotomy
Longest Common Subsequence (LCS)
Problem: Given sequences x[1..m] andy[1..n], find a longest commonsubsequence of both. - Example: x=ABCBDAB andy=BDCABA,
i
j
i
j
i^ x x … xi- xi
j y y
yj- yj =x i
k z 1 z 2 …z k- z k =y j =x i
k
k -
k
j
i^
k-
i-
j^
i
j
i
j
y j^ B D C A x j^ 0 0 0 0 0 A 0 0 0 0 1 B 0 1 1 1 1 C 0 1 1 2 2 B 0 1 1 2 2 To find an LCS follow the arrows, for each diagonal arrow there is a member of the LCS
16
17
optimal algorithm
19
optimal algorithm
20
Select the interval that ends first ( but still is not overlapping the already chosen intervals