Bitkernel · Data Structures & Algorithms
Count calls in recursive function evaluation
TrueInterview
October 7, 2026 · 1 min read
Take a look at this recursive function written in C-like pseudocode:
int x(int n) {
if (n <= 3) return 1;
else return x(n - 2) + x(n - 4) + 1;
}
When evaluating x(8), what is the total number of calls made to x, counting the top-level call x(8) as well?
Overview:
This item tests your grasp of recursion, recursive call trees, and how to count function invocations when reasoning about runtime. It often appears in software engineering fundamentals interviews to see whether you can reason about implicit call graphs and algorithmic cost; the area covered is recursion and algorithmic analysis, and the expected level is conceptual understanding rather than hands-on implementation.
Loading comments…