Recursion & Backtracking
Exhaustive search over subsets, permutations, boards and mazes.
Solve a problem by reducing it to smaller copies of itself; backtracking explores a tree of partial choices and undoes each one after exploring it.
Enumerate all 2^n subsets of a set by deciding, for each element in turn, whether to include it.
Enumerate all n! orderings of a sequence by choosing an unused element for each position in turn.
Enumerate all size-k subsets of n elements using the start-index template with a size-based base case and a "not enough elements left" prune.
Place n queens on an n×n board so none attack each other, by filling one row at a time and pruning columns and diagonals already under attack.
Fill empty cells one by one with digits that do not conflict in their row, column, or 3×3 box, backtracking on dead ends.
Find a path from start to exit in a grid by recursively stepping into open neighbors, marking cells on the current path and unmarking on retreat.
Check whether a word can be traced through adjacent grid cells without reuse, by DFS from every matching start cell with in-place visited marking.