Skip to content

Glossary: Algorithms Beyond the Basics in JavaScript

Optimal substructure

The property that the best answer to a big problem is built from best answers to smaller ones, such as `ways(n)` from `ways(n - 1)` and `ways(n - 2)`. Along with overlapping subproblems, it is what makes dynamic programming work.

Where the book teaches it

Related terms

Dynamic programmingOverlapping subproblems