Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fibonacci Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Definition:

Similar presentations


Presentation on theme: "Fibonacci Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Definition:"— Presentation transcript:

1 Fibonacci Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Definition:
fib(n) = fib(n-1) + fib(n-2) en.wikipedia.org/wiki/Fibonacci_number

2 סלט פיבונאצ'י

3 Recursion and Efficiency
Fib(6) Fib(4) The recursive form, however elegant, may be much less efficient The number of redundant calls grow exponentially!

4 Efficient Recursive Fibonacci
Pass the values that were already calculated to the recursive function This technique is called Memoization How would we keep the values that were already calculated?


Download ppt "Fibonacci Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 Definition:"

Similar presentations


Ads by Google