Recursion

Your answer
Answer & solution
Official answer: B
Step through it (24 steps)
1. For n≤0 the invocation still counts once even though it immediately returns. Starting with C(−2)=C(−1)=C(0)=1, repeatedly apply the recurrence upward; omitting the base-case calls would count printed values rather than invocations.
2. Count every invocation including base cases and the initial call. C(n)=1 for n<1 and C(n)=1+C(n−1)+C(n−3) otherwise. Thus C1=3, C2=5, C3=7, C4=11, C5=17, C6=25. Answer B.