Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiek committed Apr 9, 2024
1 parent 922e965 commit 01a12d9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lectures/dynamic-programming.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dynamic Programming

Overview
* purpose: solve optimization problems, that is find the solution that
* purpose: solve optimization problems, that is find a solution that
has the best metric among many feasible solutions
* recursive solutions to problems with optimial substructure
* memoization for problems with overlapping subproblems
Expand Down Expand Up @@ -146,7 +146,9 @@ static CutResult cut_rod(int[] P, int n) {
Sometimes the same subproblems occur over and over.

Consider the problem tree (which corresponds to the procedure call
tree) for `cut_rod`.
tree) for `cut_rod`. Notice that `cut_rod(0)` appears 10 times,
`cut_rod(1)` appears 6 times, `cut_rod(2)` appears 3 times, and
`cut_rod(3)` appears twice.

cut_rod(5)
|- cut_rod(4)
Expand Down

0 comments on commit 01a12d9

Please sign in to comment.