the algorithm in sect consists of while loop that finds path from start node to goal node when there is choice of direction on this pathall choices are pushed onto the stack by pushing all choicesif path leads to dead endthe algorithm just doesn' push anything new onto the stack the next time through the loopthe next path is popped from the stackresulting in the algorithm backtracking to point where it last made decision on the direction it was going maze representation how should the maze be representeddata representation is such an important part of any algorithm the maze consists of rows and columns we can think of each location in the maze as tuple of (rowcolumnthese tuples can be added to hash set for lookup in ( time by using hash set we can determine the adjacent (row,columnlocations in ( time as well for any location within the maze when maze is read from filethe (rowcolumnpairs can be added to hash set the adjacent function then must be given location and the maze hash set to determine the adjacent locations dfs example consider searching the maze in fig let' assume that our depth first search algorithm prefers to go up if possible when searching maze if it can' go upthen it prefers to go down next preference is given to going left in the mazefollowed lastly by going right assume we start at the top of the maze and want to exit at the bottom note that going on the diagonal is not considered in the examples presented in this since otherwise moves where two corners in the maze meet would be fig depth first search of maze this copy belongs to 'acha