Skip to content
BytePatterns

Backtracking

Try a choice, go deeper, undo it — and prune the branches that cannot win.

Backtracking progress0 / 5
  1. The Decision TreeChoose, explore, un-choose — one shared path walks the whole tree.5m
  2. SubsetsTwo branches per item: leave it out, or take it.5m
  3. PermutationsEvery unused value is a branch; the used set is the pruning.5m
  4. N-QueensOne queen per row, and a dead row sends you straight back up.6m
  5. Word Search & PruningWalk the grid, block the cell, and quit on the first wrong letter.6m

Quiz yourself: 3 questions from this module

1 / 3

What are the three moves of every backtracking loop?