Python Arena

Module 64 Extra

Recursion and backtracking

Recursion that tries every option: take a choice, follow it to the end, take it back and try the next. You build subsets with a decision tree, orderings with used flags, swaps and letter counts, combinations that skip the branches that can't work, the N queens with sets of columns and diagonals, paths and words in a grid, and a sudoku solver, with big tests where pruning is what makes a search fast.

Steps

  1. Subsets: take it or leave it
  2. Permutations
  3. Combinations and pruning
  4. The N queens
  5. Paths and words in a grid
  6. A sudoku solver