liveBook · Manning

Memoization

As explained in Advanced Algorithms and Data Structures

Memoization is a technique that caches the results of computations so repeated calls with the same inputs can reuse them.

Memoization caches results from smaller recursive subproblems so repeated calls can reuse them instead of recomputing duplicate work. In recursive graph algorithms, this can prevent explosive expansion and memory failure, although it may still leave too many possible subgraphs to make the algorithm practical. section 15.2.4

Use memoization when recursive computation revisits the same states:

  • Choose a representation for each subproblem that can serve as a cache key. section 15.2.4
  • Check the cache before recursing; return the stored result when the state has already been examined. section 15.2.4
  • Trade computation time for memory: caching avoids repeated work but does not necessarily reduce the total number of possible states enough for large inputs. section 15.2.4

How Advanced Algorithms and Data Structures covers it

How deep it goes
Explains cache lookup and storage in recursive planarity testing, but stops short of a general implementation survey.
Examples
Uses repeated graph calls, duplicate subgraphs, and a cached planarity-testing listing.
What it assumes
Requires recursive decomposition, subproblem states, and base cases.
What you can do after
Build it from scratch by adding cache lookup and result storage to a recursive graph algorithm.
How it connects
Connects recursion with dynamic programming, branch and bound, and planarity testing.

Also explained in

Compare how 8 books explain memoization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.