CSCI 1001 Lecture Notes - Lecture 15: Fibonacci Number, Human Genome
Fibonacci Number Sequence
Monday, April 23, 2018
11:19 AM
Human genome contains about 3 billion pairs - each takes 2 bits
• How much space (memory) does this require (in bytes)?
• 3 billion * 2 bits = 6 billion bits
o 6 billion bits/8 bits = 1 GB
o Typical PC will have enough main (RAM) memory to hold the entire
genome
Corn genome contains about 30 billion pairs - each takes 2 bits
• 30 billion * 2 = 60 billion bits
o 60 billion/8 = 10 billion bytes to represent
1 book = 1 MB
How long would it take to transfer the 1 GB file from the human genome over a 5
Mbit/sec line (connection)?
• 1 GB = 1000 MB = 8000Mbits/5 Mbit/sec line
• 1600 sec/60 sec/min = 227 minutes
Fibonacci Number Sequence
• An exponential function
• 0,1,1,2,3,5
• Add the previous number to current number
Fibonacci Python - recursive
• Takes time the larger the numbers
• Def fin(n):
o If (n == 0):
• Print("Fibonacci number 0 is 0")
• Return 0
o Elif (n == 1):
• Print("Fibonacci number 1 is 1")
• Return 1
o Else:
• Return fib(n - 1) + fib(n - 2)
Fibonacci Python - Iterative
• Almost instant, no matter what size number
• Linear algorithm
• Def fib(n):
o Count = 1
find more resources at oneclass.com
find more resources at oneclass.com