count = 0
def fibonacci(n):
global count
count = count + 1
if not isinstance(n, int):
print ('Invalid Input')
return None
if n < 0:
print ('Invalid Input')
return None
if n == 0:
return 0
if n == 1:
return 1
fib = fibonacci(n-1) + fibonacci(n-2)
return fib
fibonacci(8)
print(count)
I was trying to find out the running time of this fibonacci program. Can any one help me in solving the recurrence relation for the same..
T(n) = T(n-1) + T(n-2)...What would be the running time calculation from here?
Thanks... :)