What does Backtracking mean?
Backtracking is an algorithm for capturing some or all solutions to given computational issues, especially for constraint satisfaction issues. The algorithm can only be used for problems which can accept the concept of a “partial candidate solution” and allows a quick test to see if the candidate solution can be a complete solution. Backtracking is considered an important technique to solve constraint satisfaction issues and puzzles. It is also considered a great technique for parsing and also forms the basis of many logic programming languages.
Techopedia explains Backtracking
Backtracking helps in solving an overall issue by finding a solution to the first sub-problem and then recursively attempting to resolve other sub-problems based on the solution of the first issue. If the current issue cannot be resolved, the step is backtracked and the next possible solution is applied to previous steps, and then proceeds further. In fact, one of the key things in backtracking is recursion. It is also considered as a method of exhaustive search using divide and conquer. A backtracking algorithm ends when there are no more solutions to the first sub-problem.
Backtracking is an algorithm which can help achieve implementation of nondeterminism. It takes a depth-first search of a given issue space. It is used mostly in logic programming languages like Prolog. Wherever backtracking can be applied, it is faster than the brute force technique, as it eliminates a large number of candidates with a single test.