SlideShare a Scribd company logo
Fibonacci Number




Tonny Xu
VoyageGroup 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 the
candidate to write an
algorithm 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 sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...
What’s Fibonacci Number

•an integer sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

•named after Leonardo of Pisa
What’s Fibonacci Number

•an integer sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

•named after Leonardo of(aka Fibonacci)
                         Pisa
What’s Fibonacci Number

•an integer sequence
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144...

•named after Leonardo of(aka Fibonacci)
                         Pisa
•in mathematics
What’s Fibonacci Number

•an integer sequence
0, 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
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) = 4807526976

   INT64_MAX = 9223372036854775807
   fib(93) = 12200160415121876738
   UINT64_MAX = 18446744073709551615
   fib(94) = 19740274219868223167
Thank you ^_^

More Related Content

PPTX
6) fibonacci spiral
PDF
Frequency table and Bar Graph
PPTX
541 Interactive ppt Fibonacci Sequence
PPTX
How to think like a programmer easy.pptx
PDF
Fibonacci Retracements
PPTX
Fibonacci series by saadat ali achakzai
PPT
Fibonacci sequence
KEY
1.29.user,user,user
6) fibonacci spiral
Frequency table and Bar Graph
541 Interactive ppt Fibonacci Sequence
How to think like a programmer easy.pptx
Fibonacci Retracements
Fibonacci series by saadat ali achakzai
Fibonacci sequence
1.29.user,user,user

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Programs and apps: productivity, graphics, security and other tools
A Presentation on Artificial Intelligence
Assigned Numbers - 2025 - Bluetooth® Document
Building Integrated photovoltaic BIPV_UPV.pdf
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Chapter 3 Spatial Domain Image Processing.pdf
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
Reach Out and Touch Someone: Haptics and Empathic Computing
A comparative analysis of optical character recognition models for extracting...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
sap open course for s4hana steps from ECC to s4
Per capita expenditure prediction using model stacking based on satellite ima...
Programs and apps: productivity, graphics, security and other tools
Ad
Ad

fibonacci number @VoyageGroup.com

Editor's Notes