Memoization
- Make it work
- visualize the problem as a tree
- implement the tree using recursion
- test it
- Make it efficient
- add a memo object (typically a dictionary)
- add a new base case to return memo values
- se ho il valore memorizzato nel memo obj, allora usa quello
- altrimenti memorizzalo nell’oggetto memo
Memoization recipe
Approach to solve problems (top-down).
Make it work
- visualize the problem as a tree
- implement the tree using recursion
- test it
Make it efficient
- add memo object
- add a base case to return memo values
- store return values into the memo