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

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

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

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

View Full Document Right 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 .
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…
Image of page 3

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

View Full Document Right 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, …
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
Image of page 5

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

View Full Document Right 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.
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 .
Image of page 7

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

View Full Document Right 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 .
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern