The following diagram shows the four calls involved when the
recursivePowerOf2
method is set to work on 3
:
Arguments | ^ Returned values 3 v | 8 *-------------* | First call | *-------------* | ^ 2 v | 4 *-------------* | Second call | *-------------* | ^ 1 v | 2 *-------------* | Third call | *-------------* | ^ 0 v | 1 *-------------* | Fourth call | *-------------*