For an assignment I've been asked to program a Java command line application that reads in from an ASCII file the structure of a maze, the program should then identify whether the maze is solvable hence have a beginning and an end. Example below:

# #  
  # #
 ## #

The problem is that instead of using recursive calls in the implementation it must use stacks, I'm not asking for anyone to code this but I'm unsure as to how this can be achieved?

Any advice is appreciated, thanks.

Think of using the stack as a place to put something to be processed later by your algorithm as opposed to recursion being used to process it right now.

From your starting position, examine whatever you need to check. If it meets the criteria, push it onto the stack instead of making the recursive call. Once you've checked everything from the current position, pop from the stack and continue in the same manner. You're done when you have checked the last item from the stack.

Using a stack or queue will tend to work outward more gradually from the starting position by completing the task at hand before moving along to newly discovered tasks. Recursion will "rabbit trail" off through a series of discovered tasks and return to wherever it started from after completing all of the newly discovered tasks.

(I'm being intentionally vague on the operations themselves so as not to just hand you a solution to the maze checking part)