Backtracking

What is?

Backtracking can be defined as a general algorithmic technique that considers searching every possible combination in order to solve a computational problem.

Lets understand with an example:

Problem: Rat in a maze

Statement :

Given a maze of m numbers of row ,n number of columns and knumber of obstacles you have to find whether a rat starting from position (0,0) i.e, the first node can go to the position (m-1,n-1) . You have to find the from the starting cell to the target cell (if it exists)

Steps

Enter the number of rows and columns to create the table

Enter the number of obstacles

Click on the cells to marked them as obstacles

Click on "Find Path"

Click on "Show Path" to see the path

Click on "Show Code" to view the backracking code