Copyright 2012 by Shawn H Corey. Some rights reserved.
Licence under CC BY-SA 3.0
At first, recursion seems to be magic. Break the problem into smaller tasks, call the same subroutine to process those sub-tasks, and voilà, problem solved. In truth, it's not quite so simple but all recursion has four steps. Master those steps and you can do recursion with ease.