Practice Discrete Math

Algorithms / Dp Memo Vs Tabulation

Least You Need to Know: Memoization vs Tabulation

Memoization and tabulation solve the same recurrence in different directions. Interview questions often ask when one is simpler, when one avoids wasted work, and how iteration order reflects dependencies.

The least you need to know

Key notation

cache[state] memoized value for a solved subproblem
table[i] bottom-up DP entry already filled
dependency order an ordering where prerequisite states appear earlier

Tiny worked example

  • Fibonacci can be solved top-down with a memoized recursive function or bottom-up with an array.
  • Both use the same recurrence `F(n)=F(n-1)+F(n-2)`.
  • The difference is whether states are requested on demand or filled in dependency order.

Common mistakes

How to recognize this kind of problem

Start practice