Algorithms and Data Structures · Middle · Question 49 of 75

What is backtracking?

Explanation

It's a DFS over choices: add a choice, recurse, remove it. Pruning (stopping early when the partial solution can't work) is what keeps it practical. Classic problems: permutations, N-Queens, Sudoku.

Further reading

Problem with a question

Algorithms and Data Structures · Middle · question 49

Test yourself

Take the Algorithms and Data Structures · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz