Given:
<code class="language-java">public static int f(int n) { if (n <= 1) return n; return f(n - 1) + f(n - 2); } </code></pre> Using the partial call tree shown, what is <code>f(4)</code>?
- A
5
- B
4
- Ccheck_circle
3
- D
2
Explanation
This is Fibonacci: f(0)=0, f(1)=1, f(2)=1, f(3)=2, f(4)=f(3)+f(2)=2+1=3.