int fibo(int n)
int fibo_terms[100000] //arr to store the fibonacci numbers
fibo_terms[0] = 0
fibo_terms[1] = 1
for i: 2 to n
fibo_terms = fibo_terms + fibo_terms
return fibo_terms[n]
a) O(1)
b) O(n)
c) O(n2)
d) Exponential
What is the space complexity of the following dynamic programming implementation used to compute the nth fibonacci term?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What is the space complexity of the following dynamic programming implementation used to compute the nth fibonacci term?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!