AlgoPlus//dynamic programming / tsp-held-karp
Read the theory

Travelling Salesman · Held-Karp

Visit every city once and return home, cheaply — by reusing sub-tour costs.

Phase
Building dp
Subset size
Best cost
Legend
Visited city / partial path
Endpoint
Optimal tour
AI Tutor Workspace
In a nutshell
The travelling salesman problem asks for the cheapest route that visits every city once and returns home. Held-Karp avoids checking all n! tours by noticing that two partial routes covering the same cities and ending at the same one have identical futures — so it stores the best cost per (visited-set, endpoint) and reuses it, cutting the work to about 2ⁿ·n².
Ready
Press play to begin the cinematic walkthrough.
Two tours that visit the same cities and end at the same place share a future — so remember the best cost per (visited-set, endpoint) and never re-explore it.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for Travelling Salesman · Held-Karp.