You are viewing a single comment's thread from:

RE: Recursion Strikes Again!

in LeoFinance5 months ago

I remember the most common error I got when using recursion the wrong way was "Stack overflow". That either happened because the code was conceptually wrong and didn't have a good condition to terminate the recursive loop or that it needed to go so deep that the stack really reached its limit, in which case, there were three solutions: increase the stack limit, reduce the amount of information saved in the stack (for example, the number of the parameters of the recursive function or the memory they need), and third, and more likely, rewrite the code iteratively.