Analyzing Runtime for Recursive Fibonacci in Python (Part 2) // #Shorts

preview_player
Показать описание
In the previous video, we counted by hand how many function calls our recursive Fibonacci function was making.

In this video, we modify the function to do this counting for us so that we can examine the behavior for large input values!

In the next video we will, implement a technique called memorization to drastically speed up the execution!

--

Trying out this short-form video style now that YouTube has #Shorts!

Don't worry, I will still be posting my normal longer DevOps and Cloud Infrastructure content, but I figured it would be fun to put together some quick ones like this too.

---
Join the Community:
Рекомендации по теме
Комментарии
Автор

def fib(n):
if n <= 1:
return 1
else:
return fib(n - 1) + fib(n - 2)

for n in range(1, 101):
print(fib(n))

And I had run code above in my mobile phone to get first 100 of Fibonacci sequence. 😂
Thanks for your explaining why it's so slow.

amirrezaamiri