Description: Classic application of the data structure stack:
/* A: maze problem with the stack:
Seeking an entrance to the exit in the maze path algorithm can be described as follows:
Set the initial value of the current location of the entrance location:
do {
If the current location through
Then {the current position into the top of the stack
If the location is the export position, the end
Otherwise, switch the current location of the east block for the new current position
}
Otherwise, the
If the stack is not empty and the stack position that there are other directions unexplored
Set a new current position clockwise to the top of the stack location of the next adjacent block
If the stack is not empty but the top of the stack around the location of the incommensurability
{By deleting the top of the stack location
If the stack is not empty, then re-test the new stack location
Until you find a pass adjacent to the stack
To Search:
File list (Check if you may need any files):
迷宫1.cpp