Memoization
Caching the results of a function call so the same inputs are never computed twice.
Definition
Memoization stores the answer for each input the first time a function computes it and returns the stored answer on later calls. In dynamic programming it turns exponential recursions into fast ones, because the same subproblems are reached many times. The cache must be shared by all calls of one computation; a cache created inside the function on each call remembers nothing.
In practice
A memoized Fibonacci computes fib(50) with about 100 calls instead of over 40 billion.
Learn it in context
Lessons that use this term.