CHAPTER 12

Multiple Recursion III: Backtracking

He who would search for pearls must dive below.

—John Dryden

BACKTRACKING is one of the most important algorithm design paradigms. It can be regarded as an “intelligent” brute-force strategy that performs exhaustive searches for solutions to constraint satisfaction and discrete optimization problems. The approach can be used to solve numerous puzzles and problems, including the eight-queens problem, finding paths through mazes, the sudoku puzzle, the 0-1 knapsack optimization problem, and many more.

Backtracking methods generally combine recursion and iteration, contain several parameters, and are not usually designed by strictly thinking about problem decomposition and induction. Thus, they ...

Get Introduction to Recursive Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.