AlgoViz

Backtracking

medium 20 min

Backtracking builds an answer one choice at a time and abandons a partial answer the moment it cannot work.

The backtracking toolkit

Read it, run it, change a line and run it again.

Loading editor…

Five classic problems written with the same choose, explore, unchoose rhythm. Each saves a copy of the path and undoes every change it makes.