Question: Write and test the following function that uses a Stack: def stack_maze(maze): ------------------------------------------------------- Solves a maze using Depth-First search. Use: path = stack_maze(maze) -------------------------------------------------------
Write and test the following function that uses a Stack:
def stack_maze(maze): """ ------------------------------------------------------- Solves a maze using Depth-First search. Use: path = stack_maze(maze) ------------------------------------------------------- Parameters: maze - dictionary of points in a maze, where each point represents a corridor end or a branch. Dictionary keys are the name of the point followed by a list of branches, if any. First point is named 'Start', exit is named 'X' (dict) Returns: path - list of points visited before the exit is reached, None if there is no exit (list of str) ------------------------------------------------------- """
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
