Question: Subject : Problem Solving Topics: graphs and trees, tree traversal,... Part A: Traversing a maze Consider the following maze: A|BCDE the goal square is N.

Subject : Problem Solving

Topics: graphs and trees, tree traversal,...

Subject : Problem Solving Topics: graphs and trees, tree traversal,... Part A:Traversing a maze Consider the following maze: A|BCDE the goal square isN. The arrows show the directions north(N), west(W), south(S) and east(E). Allsquares are reachable and there are no loops. STRATEGY The maze isto be traversed in the following manner: Begin on the starting square

Part A: Traversing a maze Consider the following maze: A|BCDE the goal square is N. The arrows show the directions north(N), west(W), south(S) and east(E). All squares are reachable and there are no loops. STRATEGY The maze is to be traversed in the following manner: Begin on the starting square Start with an empty list While you have not reached the goal square For each square adjacent to your current square (in the order E, S, W, N If the square has not yet been visited and there is no wall in the way, add it to the start of the list. Visit the square at the start of the list and remove that square from the list. Part A: Traversing a maze Consider the following maze: A|BCDE the goal square is N. The arrows show the directions north(N), west(W), south(S) and east(E). All squares are reachable and there are no loops. STRATEGY The maze is to be traversed in the following manner: Begin on the starting square Start with an empty list While you have not reached the goal square For each square adjacent to your current square (in the order E, S, W, N If the square has not yet been visited and there is no wall in the way, add it to the start of the list. Visit the square at the start of the list and remove that square from the list

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!