Home
[Dynamic Programming] Memoization & Tabulation Recipe
Published Nov 06, 2021
[
 DynamicProgramming
]
Recursion
- Think of the base case, and what to return in base case
- Think how we can reduce the problem size, and use recursion to solve the sub-problem.
Memoization
- Make it work
- visualize the problem as a tree
- implement the tree using recursion
- test it
- Make it efficient
- add a memo object
- add a base case to return memo values
- store return values into the memo
Tabulation
- visualize the problem as a table
- size the table based on the inputs
- initialize the table with default value
- seed the trivial answer into the table
- iterate through the table
- fill further position based on the current position
Reference