what is backtracking

10 months ago 29
Nature

Backtracking is a class of algorithms used to find solutions to computational problems, particularly constraint satisfaction problems. It involves incrementally building candidates for solutions and abandoning a candidate as soon as it is determined that the candidate cannot lead to a valid solution. The classic example of the use of backtracking is the eight queens puzzle, which asks for all arrangements of eight chess queens on a standard chessboard so that no queen attacks any other. Backtracking is often used for solving constraint satisfaction problems such as crosswords, verbal arithmetic, Sudoku, and many other puzzles. It is also applied to problems like the knapsack problem and other combinatorial optimization problems. The technique is based on recursive calling to find the solution step by step, removing solutions that do not satisfy the problems constraints. Backtracking can be used for decision problems, optimization problems, and enumeration problems. It is an important tool for solving a wide range of computational problems.