3 ms·
> but telling them that it's a familiar idea that they already implicitly understand isn't a good idea either. But people do implicitly understand recursion. Y
by cabalamat 16y ago
> but telling them that it's a familiar idea that they already implicitly understand isn't a good idea either.
But people do implicitly understand recursion. Your ancestors are your parents and their ancestors. Your descendants are your children and their descendants. Most people understand the previous two sentences.
> As soon as they figure out that for and while loops are sufficient to express all the programming ideas they can come up with
There are plenty of problems for which recursion is the most natural solution. For example, building HTML for nested comments is easy with recursion and damned difficult without.
- ay 16y agoAnother algorithm which is much simpler in its recursive form is a flood-fill - paint the screen area with a given color till you hit a "border".
- infinite8s 16y agoAny self-recursive algorithm (and possibly mutually-recursive - I haven't thought about it enough) can be expressed with an iterative algorithm if you use a stack-based structure to maintain state.
- sid0 16y agoYes, that's essentially implied by the Church-Turing thesis. :)