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.

Level: intermediateTopic: Data structures algorithms

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.