QuizNot attempted
Memoization vs tabulation
1–4 to choose, Enter to submit
Show answer & explanation
Correct answers:
- It applies when a problem has overlapping subproblems and optimal substructure
- Memoization is top-down recursion plus a cache; tabulation fills a table bottom-up
- Tabulation avoids recursion depth limits and often allows O(1)-space rolling variables
- DP fits problems with overlapping subproblems and optimal substructure
- memoization is the top-down recursion plus a cache, tabulation fills a table bottom-up, and the loop form avoids stack-depth limits and often needs only the last row or two (fib, house robber in O(1) space).
- Not always O(n²) memory: memory depends on the state space
- many DPs are O(n) or O(1).
- Recipe: brute-force recursion, spot repeated arguments, cache them, optionally invert into a loop.