Backtracking
Try a choice, undo it, try the next: subsets and N queens.
Backtracking builds an answer one choice at a time. When a choice cannot lead to a valid answer, it undoes that choice and tries the next one. Use it to list every subset, permutation or arrangement.
Expected output
[['a', 'b', 'c'], ['a', 'b'], ['a', 'c'], ['a'], ['b', 'c'], ['b'], ['c'], []]
Each item gives two branches, take it or skip it, so n items give 2ⁿ subsets. Note chosen[:]: appending chosen itself would store the same list again and again, and every entry would end up empty.
N queens
Place n queens on an n × n board so that no two share a row, column or diagonal.
Expected output
2 4 92
Checking the column and both diagonals in sets rules out most branches early. That pruning is what makes backtracking practical.