Dynamic-Programming
Exploration of Dynamic Programming in Python
Source Video (in JavaScript): https://www.youtube.com/watch?v=oBt53YbR9Kk
Principles of Dynamic Programming
-
Make it work
- Represent a recursive problem as a recursive tree (for Memoization) OR iterative table (for Tabulation).
- Implement the core recursive OR iterative logic.
- Validate that it works.
-
Make it efficient
- Identify recursive/iterative structures/patterns.
- Add a memo object (dictionary in the case of Python) as an input, often defaulted to an empty dictonary {}.
- Add a parameter to look up existing entries in memo, only do calculations if not in memo (and return values into memo).
Warning
These are my best efforts within time constraints, scripts may not be exhaustively complete or functional.