2 ms·
>algorithms should just stick to iteration altogether Well, if your algorithm performs 2 or more recursive calls per function invocation (like, say, quicksort)
by akoboldfrying 3y ago
>algorithms should just stick to iteration altogether
Well, if your algorithm performs 2 or more recursive calls per function invocation (like, say, quicksort), at least one of them needs to be an actual recursive call that uses additional stack space, since TCO is only able to mitigate a single recursive call per function invocation. (You could simulate your own stack and use iteration... but the only reason to do so in practice would be to escape some artificial restriction on native stack size.)