Section Recap

Summary of backtracking.

You've learned backtracking: try, recurse, undo.

Template:

function backtrack(state):
    if complete: record solution
    for choice in valid_choices:
        make choice
        backtrack(new_state)
        undo choice

Problems: Subsets, permutations, combinations, N-Queens, Sudoku, word search.

Pruning: Stop early if invalid, order choices smartly, break symmetry.

Backtracking explores all possibilities systematically with controlled recursion.