3 ms·
I agree where there isn't inherently a stack. Many of the introductory examples of recursion are trivially transformed to an iteration in constant space. Howev
by atq2119 5y ago
I agree where there isn't inherently a stack. Many of the introductory examples of recursion are trivially transformed to an iteration in constant space.
However, there are plenty of interesting cases where if you don't use recursion, you end up having to implement your own stack as a resizable vector.
The question "why should the busy work of hand-rolling your own stack be necessary?" is the kind of question that you don't want to waste too much time on as a working programmer, but unless some people think deeply about such questions, the field as a whole stops progressing.
As others point out in this discussion, with a 64-bit address space one could organize the stack(s) in such a way that recursion could use all of physical memory if necessary.
- deleted 5y ago[deleted]