Successfully reported this slideshow.
Upcoming SlideShare
×

# fibonacci number @VoyageGroup.com

1,158 views

Published on

An overview of Fibonacci Number

Published in: Technology
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

### fibonacci number @VoyageGroup.com

1. 1. Fibonacci NumberTonny XuVoyageGroup LT @ 2012/03/22
2. 2. Agenda•What’s Fibonacci number•What’s golden ratio•How to implement an algorithm to calculate••Other pitfalls
3. 3. If you are an interviewer
4. 4. And also, you plan to ask thecandidate to write analgorithm to calculate
5. 5. Glad to see you are here!
6. 6. What’s Fibonacci Number
7. 7. What’s Fibonacci Number•an integer sequence
8. 8. What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...
9. 9. What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of Pisa
10. 10. What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fibonacci) Pisa
11. 11. What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fibonacci) Pisa•in mathematics
12. 12. What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fibonacci) Pisa•in mathematics with: F1 = F2 = 1
13. 13. What’s Fibonacci Number•in picture
14. 14. What’s Fibonacci Number•in picture
15. 15. What’s Fibonacci Number•in picture
16. 16. What’s Fibonacci Number•in picture
17. 17. What’s golden ratio
18. 18. What’s golden ratio 0.618
19. 19. What’s golden ratio 0.618•
20. 20. What’s golden ratio 0.618••relation to Fibonacci Number
21. 21. What’s golden ratio 0.618••relation to Fibonacci Number
22. 22. How to implement the algorithm?
23. 23. Naive method
24. 24. Time?
25. 25. Bottom up
26. 26. Time?
27. 27. Can we do better?
28. 28. Use φ
29. 29. Time?But.... precision
30. 30. Use table
31. 31. Time?
32. 32. another formula
33. 33. another formula
34. 34. another formula
35. 35. Time?
36. 36. Other pitfalls•bounds check!
37. 37. Other pitfalls•bounds check! INT32_MAX = 2147483647 fib(47) = 2971215073 UINT32_MAX = 4294967295 fib(48) = 4807526976 INT64_MAX = 9223372036854775807 fib(93) = 12200160415121876738 UINT64_MAX = 18446744073709551615 fib(94) = 19740274219868223167
38. 38. Thank you ^_^