0
0
DSA Cprogramming~5 mins

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

Choose your learning style9 modes available
Recall & Review
beginner
What is the main idea behind using Dynamic Programming (DP) to calculate Fibonacci numbers?
DP stores the results of smaller subproblems (previous Fibonacci numbers) to avoid repeated calculations, making the process faster and more efficient.
Click to reveal answer
beginner
In Fibonacci DP, what does the 'memoization' technique mean?
Memoization means saving the results of Fibonacci calculations in a table (array) so that when the same value is needed again, it can be retrieved instantly instead of recalculating.
Click to reveal answer
intermediate
What is the time complexity of calculating Fibonacci numbers using DP compared to the naive recursive method?
Using DP, the time complexity is O(n) because each Fibonacci number is calculated once. The naive recursive method has exponential time complexity O(2^n) due to repeated calculations.
Click to reveal answer
intermediate
Why is the bottom-up approach often preferred over the top-down approach in Fibonacci DP?
Bottom-up builds the solution from the smallest subproblems up, using iteration and no recursion, which avoids function call overhead and stack issues, making it more efficient in practice.
Click to reveal answer
beginner
Show the base cases used in Fibonacci DP and explain why they are important.
Base cases: fib(0) = 0 and fib(1) = 1. They are important because they stop the recursion or iteration and provide starting values to build the rest of the Fibonacci sequence.
Click to reveal answer
What does DP store to optimize Fibonacci calculation?
APrime numbers
BRandom numbers
COnly the last Fibonacci number
DPrevious Fibonacci numbers
What is the time complexity of Fibonacci using DP?
AO(n)
BO(n^2)
CO(2^n)
DO(log n)
Which approach uses iteration to build Fibonacci numbers from the bottom up?
ADivide and conquer
BTop-down
CBottom-up
DGreedy
What are the base cases for Fibonacci DP?
Afib(0)=0, fib(1)=1
Bfib(1)=0, fib(2)=1
Cfib(0)=1, fib(1)=1
Dfib(2)=0, fib(3)=1
Memoization in Fibonacci DP means:
AIgnoring previous results
BSaving results to avoid repeated work
CUsing random numbers
DCalculating recursively without storage
Explain how Dynamic Programming improves the calculation of Fibonacci numbers compared to simple recursion.
Think about how remembering past answers helps.
You got /4 concepts.
    Describe the difference between top-down and bottom-up approaches in Fibonacci DP.
    One starts from the problem and breaks down, the other builds up from the smallest cases.
    You got /4 concepts.