Fibonacci NumberTonny XuVoyageGroup LT @ 2012/03/22
Agenda•What’s Fibonacci number•What’s golden ratio•How to implement an algorithm to calculate••Other pitfalls
If you are an interviewer
And also, you plan to ask thecandidate to write analgorithm to calculate
Glad to see you are here!
What’s Fibonacci Number
What’s Fibonacci Number•an integer sequence
What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...
What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of Pisa
What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fib...
What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fib...
What’s Fibonacci Number•an integer sequence0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...•named after Leonardo of(aka Fib...
What’s Fibonacci Number•in picture
What’s Fibonacci Number•in picture
What’s Fibonacci Number•in picture
What’s Fibonacci Number•in picture
What’s golden ratio
What’s golden ratio           0.618
What’s golden ratio           0.618•
What’s golden ratio                 0.618••relation to Fibonacci Number
What’s golden ratio                 0.618••relation to Fibonacci Number
How to implement the     algorithm?
Naive method
Time?
Bottom up
Time?
Can we do better?
Use φ
Time?But.... precision
Use table
Time?
another formula
another formula
another formula
Time?
Other pitfalls•bounds check!
Other pitfalls•bounds check!   INT32_MAX = 2147483647   fib(47) = 2971215073   UINT32_MAX = 4294967295   fib(48) = 4807526...
Thank you ^_^
Upcoming SlideShare
Loading in …5
×

fibonacci number @VoyageGroup.com

1,093 views

Published on

An overview of Fibonacci Number

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,093
On SlideShare
0
From Embeds
0
Number of Embeds
198
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 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 ^_^

    ×