Why is the recursion result for question 3 on the quiz, the int 8? I don’t understand how it got to that result.
Let’s look into the following tree:
Here, we expanded the tree according to the calls of the function till the base case.
When we reach the base case, the function starts returning the value and adding the returned value.
According to the given tree, the final answer of fibonacchi(7) will be 8 after adding all the returned values.