Memoization stores answers when a recursive computation first asks for them. Tabulation fills a collection of answers in an order that makes every dependency available before it is used.
Worked example
For a recurrence where state i depends on states i minus one and i minus two, a memoized version starts at the requested final state and recursively asks for missing predecessors. A tabulated version starts with the base cases and works upward. Each state is computed once when the cache or table is used correctly.
What to check
Memoization can avoid states that the requested answer never reaches. Tabulation often gives tighter control over iteration order and call-stack use. Both need correct base cases, and both can store a wrong answer efficiently if the state definition is incomplete. Include every input that affects the result in a memoization key. A cache keyed only by position is insufficient when the remaining budget also changes the answer.
Continue with the book
Explore the full treatment, worked examples, and exercises in Algorithms Made Simple.
Companion article for Algorithms Made Simple, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
