Dynamic Programming: Memoization vs Tabulation

Subject: Data Structures & Algorithms Last updated: Jul 14, 2026

Breaking Down Dynamic Programming

DP is often considered the hardest topic in interviews, but it boils down to two concepts: Overlapping Subproblems and Optimal Substructure.

Approaches

  1. Top-Down (Memoization): Write a recursive function and cache the results of subproblems in a hash map or array. Easier to conceptualize.
  2. Bottom-Up (Tabulation): Build a table iteratively from the base cases up to the target. Avoids recursion stack overhead.

Classic DP Problems

  • 0/1 Knapsack Problem
  • Longest Common Subsequence
  • Matrix Chain Multiplication