Skip to content

Memoization vs caching vs dynamic programming

Memoization is a top-down cache inside a function; classic caching is often external and time-based; DP is the bottom-up equivalent.

Aspect

Memoization

Cache

Dynamic Programming

Scope

Function calls

External resources

Algorithm design

Key

Arguments

URL, ID, query

Subproblems

Eviction

Usually unbounded

LRU, TTL

N/A (precomputed)

Example

useMemo(f, [x])

Redis, HTTP cache

Fibonacci table