Source: https://lipn.univ-paris13.fr/~levy/algoA/cours8progRecursive.pdf