AI engineering glossary · Data structures algorithms
What is backtracking?
Backtracking: A search strategy that builds a solution one choice at a time and abandons a partial solution as soon as it cannot lead to a valid answer, then undoes the last choice and tries another. It is used for puzzles and constraint problems.
Backtracking: an example
In placing 8 queens on a chessboard so none attack, backtracking drops a placement immediately when a queen is attacked instead of finishing the board.
Related terms
More Data structures algorithms terms
- Base case
- Bellman-Ford algorithm
- Big-O notation
- Big-Omega notation
- Big-Theta notation
- Binary search
- Binary search tree
- Binary tree
Where you learn it
Backtracking is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.