|
@ -1,14 +1,14 @@ |
|
|
import matplotlib.pyplot as plt |
|
|
import matplotlib.pyplot as plt |
|
|
import time |
|
|
import time |
|
|
from fibonacci import Fibonacci as fib |
|
|
|
|
|
|
|
|
import Fibonacci as fib |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def measureTime(n): |
|
|
def measureTime(n): |
|
|
|
|
|
|
|
|
total = 0 |
|
|
total = 0 |
|
|
for i in range(0, 200): |
|
|
|
|
|
|
|
|
for i in range(0, 200000): |
|
|
start_time = time.time() |
|
|
start_time = time.time() |
|
|
fib.fibPower(n) |
|
|
|
|
|
|
|
|
fib.fibClosedFormula(n) |
|
|
end_time = time.time() |
|
|
end_time = time.time() |
|
|
total += end_time - start_time |
|
|
total += end_time - start_time |
|
|
return total/200 |
|
|
return total/200 |
|
@ -18,7 +18,7 @@ def generateData(): |
|
|
time = [] |
|
|
time = [] |
|
|
input = [] |
|
|
input = [] |
|
|
|
|
|
|
|
|
for i in range(1, 2000, 20): |
|
|
|
|
|
|
|
|
for i in range(1, 1000, 20): |
|
|
input.append(i) |
|
|
input.append(i) |
|
|
time.append(measureTime(i)) |
|
|
time.append(measureTime(i)) |
|
|
return input, time |
|
|
return input, time |
|
|