AiTechWorlds
AiTechWorlds
Animate the bottom-up Fibonacci DP table, each value summed from the previous two, with synced code.
| F(0) | F(1) | F(2) | F(3) | F(4) | F(5) | F(6) | F(7) | F(8) | F(9) | F(10) | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| dp | 0 | 1 | · | · | · | · | · | · | · | · | · |
def fib(n):
dp = [0] * (n + 1)
dp[1] = 1
for i in range(2, n + 1):
dp[i] = dp[i - 1] + dp[i - 2]
return dp[n]The Fibonacci sequence is the classic introduction to dynamic programming: each value is the sum of the previous two, computed bottom-up to avoid the exponential recomputation of naive recursion.
| Time | O(n) |
| Space | O(n) |
The Fibonacci DP Visualizer animates the bottom-up dynamic programming solution for Fibonacci numbers. Each dp[i] is computed as dp[i-1] + dp[i-2], avoiding the exponential recomputation of naive recursion. It runs in O(n) time and O(n) space (reducible to O(1)). Watch the table fill cell by cell.
Press Play
Watch the dp table fill from the base cases F(0)=0 and F(1)=1.
Step through
Use Step Forward/Back or the timeline to see each F(i) = F(i-1) + F(i-2).
Read the code
View the tabulated Fibonacci in C++, Java, Python, or JavaScript and copy it.
100% Private — No Server Required
All processing happens directly in your browser. No data is uploaded, stored, or transmitted to any server.
Last reviewed on June 14, 2026 by the AiTechWorlds Tools Team. All processing runs locally in your browser.