I would do the recursion for this problem like this:
Check left, if returns 'exit found', return 'exit found'
Check right, if returns 'exit found', return 'exit found'
Check forward, if returns 'exit found', return 'exit found'
return 'exit not found'
this assumes that one of the arguments of the function is 'where I came from' and the 'left', 'right' and 'forward' are calculated relatively to it.
Killing a stack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement