Implementing backtracking algorithms
Backtracking solutions are implemented using recursive function calls. We use these recursive function calls to move from one state to another, starting from the initial problem state. Each function call from a state signifies a choice that leads to another state. This process continues until we reach a terminal state where we decide if our decisions make up a proper solution using some validation function/algorithm.
In case we reach a state that is not a solution, the function call ends and returns the control to the caller, which is also the state from where we moved to the next state. At this point, we can move to a new state, continue the process, or backtrack even further.
Implementation
Liking the course? Check our discounted plans to continue learning.