Top Banner
4/14/20 1 Lecture 16 – Dynamic Programming Reading: KT Sections 6.1 and 6.2 Partial content of these slides have been obtained from the official lecture slides that accompany the textbook. A complete set of slides can be found at: http://www.cs.princeton.edu/~wayne/kleinberg-tardos/ Algorithm techniques Data structures • Use extra data structures • Exploit the structure to improve complexity Greedy algorithms • Build up a solution incrementally • Myopically optimizing some local criterion Divide and conquer • Break up a problem into independent subproblems • Solve each subproblem • Combine solutions to subproblems to form solution to original problem Dynamic Programming • Break up a problem into a series of overlapping subproblems • Build up solutions to larger and larger subproblems
6

Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

Aug 17, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

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

Page 2: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

4/14/20

2

Abitofhistory

WeightedIntervalSchedulingproblem

Page 3: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

4/14/20

3

WeightedIntervalSchedulingproblem

Let’strysolvingit

• Willgreedywork?

• Howaboutdivideandconquer?

• Istheresomestructureintheproblemthatwecanexploit?

Page 4: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

4/14/20

4

Let’sdefineafewnotions

Morenotations

Page 5: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

4/14/20

5

Abruteforcesolution

What’sthecomplexityofthisalgorithm?

Memoization

What’sthecomplexityofthisalgorithm?

Page 6: Lecture 16 –Dynamic Programming - Wellesley Collegecs231/lectures/lec16.pdf · 2020. 4. 14. · Dynamic programming = planning over time. Secretary of Defense was hostile to mathematical

4/14/20

6

Bottom-updynamicprogramming