AI engineering glossary · Data structures algorithms
What is optimal substructure?
Optimal substructure: The property that an optimal solution to a problem contains within it optimal solutions to its subproblems. It is what allows dynamic programming and greedy methods to build a global answer from local ones.
Optimal substructure: an example
A shortest route from Delhi to Chennai through Nagpur must use the shortest Delhi-Nagpur route as its first part.
Related terms
More Data structures algorithms terms
- Overlapping subproblems
- P versus NP
- Polynomial time
- Prefix sum
- Prim's algorithm
- Priority queue
- Queue
- Quickselect
Where you learn it
Optimal substructure is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.