Re:How not to teach recursion (2021)
by edflsafoiewq on Saturday June 18, 2022 @03:12PM
(#31792816)
Even the basic schoolbook algorithms are recursive
In fact the usual method is even non-tail recursive, you build up a (literal!) stack of intermediate results which you sum back up at the end.
[ Parent
| on HN ]
The usual method is iterative:
for digit in a, for digit in b, multiply digits and offset by sum of indices of digits. The sun results.
Re:How not to teach recursion (2021)
by contravariant on Saturday June 18, 2022 @07:43PM
(#31794819)
I think most schoolbook algorithms are tail recursive.
They're a bit hard to write down otherwise.