def fib1(n):
if(n == 0):
return 0
elif(n == 1):
return 1
else:
return fib1(n-1)+fib1(n-2)
def fib2(n):
a = 0
b = 1
if(n == 0):
return 0
elif(n == 1):
return 1
else:
for i in range(2, n+1):
c = a+b
a = b
b = c
return b
Which of the following are true about the functions fib1 and fib2 defined above?
a) fib2 executes in exponential time
b) fib1 executes in linear time
c) fib2 is executed to execute faster than fib1
d) fib1 is executed to execute faster than fib2
Answers
Answered by
0
Answer:
it is the answer so it is the answer as it is the answer that's why it's the answer finally it's only the answer
Similar questions