Python dynamic programming with lru_cache, in 4 images. 🐍
One decorator, one table, one rule: solve each subproblem once.
#Python #Coding
Python Dijkstra's algorithm with heapq, in 4 images. 🐍
A weighted graph, a heap, and one rule: keep the cheaper distance.
#Python #Coding
How to find the shortest path in a graph, in 4 images. 🐍
A dict of neighbours, a queue, a seen set.
#Python #Coding

![Slide reading 'Dynamic programming in Python, solve it once'. The next slides show Python dynamic programming: @lru_cache on a recursive fib function, the knapsack loop best[c] = max(best[c], best[c - w] + v), and the takeaway that top down is memoisation and bottom up is tabulation.](https://pbs.twimg.com/media/HVMyB9vbMAAOEcU.png?name=small&format=webp)






















