drawkcaB | Backward Compatible logo

rants and tips about software

How to explain recursion to a kid

Once upon a time, there was this kid that wanted to know about recursion. His father told him:

Son, once upon a time, there was this kid that wanted to know about recursion. His father told him:

Son, once upon a time, there was this kid that wanted to know about recursion. His father told him:

Son, once upon a time, there was this kid that wanted to know about recursion. His father told him:

Son, once upon a time, there was this kid that wanted to know about recursion. His father told him:

...

ok, now we're five levels deep into recursion and also have 5 items (father+son stories) on the stack. Once a father decides to change the story to end it instead of recurse further, the stack will unwind and function at the top (this blog post), will end.

Milan Babuškov, 2011-12-01
Copyright © Milan Babu┼íkov 2006-2014