Skip to main content

Posts

Showing posts from June, 2022

Backtracking strategy

  Anytime you have a problem that is solved by a series of decisions there are chances that you might make a wrong decision and when you realize that you have to backtrack to a place where you made that decision and try something else, that what backtracking is. It is an efficient technique that uses  a brute force approach  to solve algorithm problems. In backtracking, we search depth-first for solutions backtracking to the last valid path as soon as we hit a dead end. Backtracking decreases the search space since we at this point don’t need to follow down anyways, we know are invalid. This is called  pruning . We should have the option to test a partial solution: for instance, we can’t track down global optimum utilizing backtracking, since we have no clue if the solution, we’re as of now on can prompt it or not. However, we can, for instance, address Sudoku utilizing backtracking. We can know quickly if our answer so far is invalid by testing if two of a similar n...