You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/dynamic_programming/intro-to-dp.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ These alternative ways of saving state are primarily useful when saving vectors
80
80
### *** Very important note***
81
81
82
82
The layman's way of analyzing the runtime of a memoized recursive function is:
83
-
$$** (work per subproblem) * (number of subproblems) **$$
83
+
$${ \text{work per subproblem} * \text{number of subproblems} }$$
84
84
85
85
86
86
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.
@@ -150,4 +150,4 @@ Of course, the most important trick is to practice.
0 commit comments