Algorithms

Memoization

Cache function results by argument tuple.


In plain terms

Bottom of dynamic programming. Trivially turns exponential recursion into polynomial time, at the cost of memory.

Origin

Term coined by Donald Michie in 1968. The bottom of every dynamic-programming algorithm; turns exponential recursion into polynomial time, trading memory.

Where it shows up in production
  • React useMemo / useCallback Same idea at the component level — cache the result by deps.
  • Functools @cache (Python) Memoization decorator in the stdlib. Built on a dict.
Sources & further reading
Found this useful?