Skip to the content.

Deep Dive: Task 3 Deep Dive — Bottom-Up Strategy (Tabulation)

Concept

Tabulation builds solutions from the ground up. Start from base cases and iteratively fill a table until you reach F(n).

Time & Space Complexity

Implementation Notes

Pseudocode

dp = array of size n+1
if n <= 1: return n
dp.at(0) = 0
dp.at(1) = 1
for i in [2..n]:
    dp.at(i) = dp.at(i-1) + dp.at(i-2)
return dp.at(n)

When to Prefer Tabulation

Pitfalls