In developing a recursive solution, consider the base cases first. What situation(s) cause the recursive method to exit?
MAXROW
or MAXCOL
means that we have found an exit point.The general case of encountering a blank space requires the following steps:
When an exit point is found, print only the successful trail of '!' marks that leads to an exit. As a result, it is necessary for each recursive call to work with a copy of the array. Why is this? If a reference to the original array is passed with each recursive call, the placement of '!' marks would be permanent in the data structure.
Last modified: March 04, 2023
Back to Defining The Maze Problem