17-dynprog2 - Dynamic Programming Comp 122, Fall 2004...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Comp 122, Fall 2004 Dynamic Programming
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Comp 122, Spring 2004 nprog - 2 Lin / Devi Longest Common Subsequence Problem: Given 2 sequences, X = x 1 ,...,x m and Y = y 1 ,...,y n , find a common subsequence whose length is maximum. springtime ncaa tournament basketball printing north carolina krzyzewski Subsequence need not be consecutive , but must be in order .
Background image of page 2
Comp 122, Spring 2004 nprog - 3 Lin / Devi Other sequence questions Edit distance: Given 2 sequences, X = x 1 ,...,x m and Y = y 1 ,...,y n , what is the minimum number of deletions, insertions, and changes that you must do to change one to another? Protein sequence alignment: Given a score matrix on amino acid pairs, s(a,b) for a,b { Λ } A, and 2 amino acid sequences, X = x 1 ,...,x m ⟩ ∈ A m and Y = y 1 ,...,y n ⟩ ∈ A n , find the alignment with lowest score…
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Comp 122, Spring 2004 nprog - 4 Lin / Devi More problems Optimal BST: Given sequence K = k 1 < k 2 < ··· < k n of n sorted keys, with a search probability p i for each key k i , build a binary search tree (BST) with minimum expected search cost . Matrix chain multiplication: Given a sequence of matrices A 1 A 2 … A n , with A i of dimension m i × n i , insert parenthesis to minimize the total number of scalar multiplications. Minimum convex decomposition of a polygon, Hydrogen placement in protein structures, …
Background image of page 4
Comp 122, Spring 2004 nprog - 5 Lin / Devi Dynamic Programming Dynamic Programming is an algorithm design technique for optimization problems : often minimizing or maximizing. Like divide and conquer, DP solves problems by combining solutions to subproblems. Unlike divide and conquer, subproblems are not independent. » Subproblems may share subsubproblems, » However, solution to one subproblem may not affect the solutions to other subproblems of the same problem. (More on this later.) DP reduces computation by » Solving subproblems in a bottom-up fashion. » Storing solution to a subproblem the first time it is solved. » Looking up the solution when subproblem is encountered again. Key: determine structure of optimal solutions
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Comp 122, Spring 2004 nprog - 6 Lin / Devi Steps in Dynamic Programming 1. Characterize structure of an optimal solution. 2. Define value of optimal solution recursively. 3. Compute optimal solution values either top- down with caching or bottom-up in a table . 4. Construct an optimal solution from computed values. We’ll study these with the help of examples.
Background image of page 6
Comp 122, Spring 2004 nprog - 7 Lin / Devi Longest Common Subsequence Problem: Given 2 sequences, X = x 1 ,...,x m and Y = y 1 ,...,y n , find a common subsequence whose length is maximum. springtime ncaa tournament basketball printing north carolina snoeyink Subsequence need not be consecutive , but must be in order .
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Comp 122, Spring 2004 nprog - 8 Lin / Devi Naïve Algorithm For every subsequence of X , check whether it’s a subsequence of Y .
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 33

17-dynprog2 - Dynamic Programming Comp 122, Fall 2004...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online