Backtracking
Backtracking is used in algorithms in which there are steps along some path
(state) from some starting point to some goal.
Find your way through a maze.
Find a path from one point in a graph (roadmap) to another point.
Play a game in which there are moves to be made (checkers, chess).
In all of these cases, there are choices to be made among a number of options.
We need some way to remember these decision points in case we want/need
to come back and try the alternative Consider the maze. At a point where a
choice is made, we may discover that the choice leads to a dead-end. We want
to retrace back to that decision point and then try the other (next) alternative.
Again, stacks can be used as part of the solution. Recursion is another, typically
more favored, solution, which is actually implemented by a stack.