Backtracking
Last updated
What is Backtracking?
Backtracking is a powerful algorithmic technique that aims to solve a problem incrementally, by trying out an various sequences of decisions. If at any point it realizes that its current path will not lead to a solution, it reverses or "backtracks" the most recent decision and tries the next available route. Backtracking is often applied in problems where the solution requires the sequence of decisions to meet certain constraints, like the 8-queens puzzle or the traveling salesperson problem. In essence, it involves exhaustive search and thus, can be computationally expensive. However, with the right sorts of constraints, it can sometimes find solutions to problems with large and complex spaces very efficiently.
Free resources to learn Backtracking
More in stage 14: Problem Solving Techniques
Backtracking: common questions
Can I learn Backtracking in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Backtracking in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Backtracking tutorial for beginners?
It is lesson 90 of 107 in the free Data Structures & Algorithms roadmap, in stage 14, Problem Solving Techniques. If you are new to Data Structures & Algorithms, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.