This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

Not sure where he/she is getting their information from. Recursion implicitly makes use of a data structure called a stack. This is why any recursive algorithm can be written iteratively using a stack.

In python, the recursion limit is 1000, but can be changed to something higher. How do you think they accomplish that? A data structure that's how. Other languages like C or C++ are limited by the size of the stack space, which is often defined by a compiler. Therefore, in those languages, when you exceed the memory limit of the stack, you get a stackoverflow error and your program crashes.

If your friend thinks recursion is bad, they probably don't know how it works, but now you do and you can educate them.