lecture 16 –dynamic programming - wellesley collegecs231/lectures/lec16.pdf · 2020. 4. 14. ·...
TRANSCRIPT
4/14/20
1
Lecture16– DynamicProgrammingReading:KTSections6.1and6.2
Partialcontentoftheseslideshavebeenobtainedfromtheofficiallectureslidesthataccompanythetextbook.Acompletesetofslidescanbefoundat:http://www.cs.princeton.edu/~wayne/kleinberg-tardos/
Algorithmtechniques
Datastructures•Useextradatastructures• Exploitthestructuretoimprovecomplexity
Greedyalgorithms•Buildupasolutionincrementally•Myopicallyoptimizingsomelocalcriterion
Divideandconquer•Breakupaproblemintoindependentsubproblems• Solveeachsubproblem•Combinesolutionstosubproblemstoformsolutiontooriginalproblem
DynamicProgramming•Breakupaproblemintoaseriesofoverlappingsubproblems
•Buildupsolutionstolargerandlargersubproblems
4/14/20
2
Abitofhistory
WeightedIntervalSchedulingproblem
4/14/20
3
WeightedIntervalSchedulingproblem
Let’strysolvingit
• Willgreedywork?
• Howaboutdivideandconquer?
• Istheresomestructureintheproblemthatwecanexploit?
4/14/20
4
Let’sdefineafewnotions
Morenotations
4/14/20
5
Abruteforcesolution
What’sthecomplexityofthisalgorithm?
Memoization
What’sthecomplexityofthisalgorithm?
4/14/20
6
Bottom-updynamicprogramming