4 ms·
all iterations are recursion but not the other way around.
by vincnetas 2y ago
all iterations are recursion but not the other way around.
- cryptonector 2y agoWhen you add an explicit stack to help you keep state then you can have recursion be the same as iteration. Normally the stack you get in recursion is implicit rather than explicit.
- eru 2y agoA stack is one way to implement a specific kind of recursion on a computer. But see https://news.ycombinator.com/item?id=42234121 https://news.ycombinator.com/item?id=42234121 for other examples of recursion.