CompuServe Messages

GURU.error

    22-Sep-90 16:30:01
Sb: #826-GURU.error
Fm: Harry Callesis 72025,117
To: Henry Williams 73527,1446
Henry – I agree with the other replies, inasmuch as removing the recursive call will stop the recursion from happening. There are instances, though, where recursion is the "best" way to get something done. What you're probably missing is a termination condition – i.e., "I've looked in every direction already and there's no use looking any more, so return without making the recursive call". It's still quite possible to overrun your stack this way (if, for instance, to cover all possibilities you must make more recursive calls than your stack will allow), so if you set a termination condition in the recursion and find yourself still running out of stack, you'll probably want to re-think your algorithm to eliminate most or all recursion. Hope this helps … Harry