TopRecursion in methods

Recursion in methods

We can also do recursion in methods rather than classes and objects. This is when you have a method that requests itself during a computation. As a first example, we saw an algorithm to computer fast powers of numbers. powers

We then looked at solving theTowers of Hanoi, which called for us to move 64 golden disks on one of 3 diamond tipped needles to one of the others while only moving one disk at a time and never placing a larger golden disk on a smaller one.

In each of these cases we ensured that there was a base case (one that involved no recursive calls) and that the recursive cases eventually got down to a base case.


TopRecursion in methods