15-Dynamic-Programming

# 15-Dynamic-Programming - Algorithms LECTURE 15 Dynamic...

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

Algorithms L15.1 Professor Ashok Subramanian L ECTURE 15 Dynamic Programming Longest common subsequence Optimal substructure Overlapping subproblems Algorithms

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

View Full Document
Algorithms L15.2 Dynamic programming Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two sequences x [1 . . m ] and y [1 . . n ] , find a longest subsequence common to them both.
Algorithms L15.3 Dynamic programming Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two sequences x [1 . . m ] and y [1 . . n ] , find a longest subsequence common to them both. “a” not “the”

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

View Full Document
Algorithms L15.4 Dynamic programming Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two sequences x [1 . . m ] and y [1 . . n ] , find a longest subsequence common to them both. x : A B C B D A B y : B D C A B A “a” not “the”
Algorithms L15.5 Dynamic programming Design technique, like divide-and-conquer. Example: Longest Common Subsequence (LCS) Given two sequences x [1 . . m ] and y [1 . . n ] , find a longest subsequence common to them both. x : A B C B D A B y : B D C A B A “a” not “the” BCBA = LCS( x , y ) functional notation, but not a function

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

View Full Document
Algorithms L15.6 Brute-force LCS algorithm Check every subsequence of x [1 . . m ] to see if it is also a subsequence of y [1 . . n ] .
Algorithms L15.7 Brute-force LCS algorithm Check every subsequence of x [1 . . m ] to see if it is also a subsequence of y [1 . . n ] . Analysis Checking = O ( n ) time per subsequence. 2 subsequences of x (each bit-vector of Worst-case running time = O ( n 2 )

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

View Full Document
Algorithms L15.8 Towards a better algorithm Simplification: 1. Look at the length of a longest-common subsequence.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern