From the course: Advanced Algorithmic Thinking with Python
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Bottom-up dynamic programming example - Python Tutorial
From the course: Advanced Algorithmic Thinking with Python
Bottom-up dynamic programming example
- [Instructor] If you check out branch 04_03, you will find a file called fibonacci_tabulation.py. This is an example of the bottom up approach to dynamic programming. Now, it's actually quite a contrived example because you probably wouldn't use dynamic programming in the real world for this particular problem. The way it works is we're building a table of values. So if we want to find the Nth Fibonnacci number, we have already found all the previous ones and we can refer to our table of values. In this particular example, this approach is also very inefficient on space because we don't actually need all of the previous Fibonacci numbers. We only actually need the previous two. But the point is to understand how this bottom up approach works. So, I encourage you to spend a bit of time making sure you really understand what's happening here and then this will help you to understand what's coming next.
Contents
-
-
-
-
-
-
Introduction to dynamic programming56s
-
(Locked)
Top-down dynamic programming example2m 26s
-
(Locked)
Bottom-up dynamic programming example47s
-
(Locked)
The knapsack problem: Theory5m 7s
-
(Locked)
The knapsack problem: Python implementation3m 54s
-
(Locked)
Challenge: The knapsack problem36s
-
(Locked)
Solution: The knapsack problem16s
-
-
-