6 ms·
Since with recursion you can have a large but finite number of calls that could blow the stack, but not have the same problem with a for loop.
by rgoddard 15y ago
Since with recursion you can have a large but finite number of calls that could blow the stack, but not have the same problem with a for loop.
- eru 15y agoYes, you have to account for that. Also, tail recursion should be fine, if your compiler is smart enough. (I guess since the program is looking at assembly, it couldn't tell optimized tail recursion from a loop.)