Question 1 of 5
A tile pattern uses power(2, 5).
public static int power(int base, int exp)
{
if (exp == 0)
{
return 1;
}
return base * power(base, exp - 1);
}
| Call | base | exp | Value returned |
|---|---|---|---|
| 1 (original) | 2 | 5 | |
| 2 | 2 | 4 | |
| 3 | 2 | 3 | |
| 4 | 2 | 2 | |
| 5 | 2 | 1 | |
| 6 | 2 | 0 |
(a) Fill the returned values from the base case upward. (b) State how many calls occur, including the original. (c) Identify the base case.