0
0
DSA Cprogramming~5 mins

Fibonacci Using Recursion in DSA C - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the base case in a recursive Fibonacci function?
The base case returns the first two Fibonacci numbers directly, usually when n is 0 or 1, to stop the recursion.
Click to reveal answer
beginner
Explain how recursion works in calculating Fibonacci numbers.
Recursion calculates Fibonacci by calling itself with smaller values (n-1 and n-2) and adding their results until it reaches the base case.
Click to reveal answer
intermediate
What is the time complexity of the naive recursive Fibonacci algorithm?
The time complexity is exponential, specifically O(2^n), because it recalculates the same values many times.
Click to reveal answer
beginner
Show the recursive formula used in Fibonacci calculation.
fib(n) = fib(n-1) + fib(n-2) with base cases fib(0) = 0 and fib(1) = 1.
Click to reveal answer
intermediate
Why is recursion not efficient for large Fibonacci numbers without optimization?
Because it repeats calculations for the same inputs many times, leading to a lot of unnecessary work and slow performance.
Click to reveal answer
What does the base case in Fibonacci recursion return for fib(0)?
A1
B0
C2
DUndefined
Which of the following best describes the recursive call in Fibonacci?
Afib(n) calls fib(n-1) and fib(n-2)
Bfib(n) calls fib(n+1) and fib(n+2)
Cfib(n) calls fib(n-1) only
Dfib(n) calls fib(n-2) only
What is the main drawback of the naive recursive Fibonacci method?
AExponential time complexity
BRequires loops
CDoes not return correct results
DUses too much memory
What is the output of fib(3) using recursion?
A5
B3
C1
D2
Which technique can improve recursive Fibonacci efficiency?
ASorting
BBinary search
CMemoization
DStack
Describe how the Fibonacci sequence is calculated using recursion, including base cases and recursive calls.
Think about how the function calls itself with smaller numbers until it reaches the simplest cases.
You got /4 concepts.
    Explain why the naive recursive Fibonacci algorithm is inefficient and how you might improve it.
    Consider what happens when the function calls itself many times with the same inputs.
    You got /4 concepts.