Skip to content

Commit

Permalink
Update intro-to-dp.md
Browse files Browse the repository at this point in the history
Someone added the r to memoization despite the beginning of the article literally mentioning not to do this 馃様.馃槀
  • Loading branch information
mhayter committed Apr 25, 2024
1 parent 7e4b0db commit 27cb5c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/dynamic_programming/intro-to-dp.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $$\text{work per subproblem} * \text{number of subproblems}$$

Using a binary search tree (map in C++) to save states will technically result in $O(n \log n)$ as each lookup and insertion will take $O(\log n)$ work and with $O(n)$ unique subproblems we have $O(n \log n)$ time.

This approach is called top-down, as we can call the function with a query value and the calculation starts going from the top (queried value) down to the bottom (base cases of the recursion), and makes shortcuts via memorization on the way.
This approach is called top-down, as we can call the function with a query value and the calculation starts going from the top (queried value) down to the bottom (base cases of the recursion), and makes shortcuts via memoization on the way.

## Bottom-up Dynamic Programming

Expand Down

0 comments on commit 27cb5c9

Please sign in to comment.