Repository where I mostly put random python scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
577 B

  1. import matplotlib.pyplot as plt
  2. import time
  3. from fibonacci import Fibonacci as fib
  4. def measureTime(n):
  5. total = 0
  6. for i in range(0, 200):
  7. start_time = time.time()
  8. fib.fibPower(n)
  9. end_time = time.time()
  10. total += end_time - start_time
  11. return total/200
  12. def generateData():
  13. time = []
  14. input = []
  15. for i in range(1, 2000, 20):
  16. input.append(i)
  17. time.append(measureTime(i))
  18. return input, time
  19. data = generateData()
  20. plt.plot(data[0], data[1])
  21. plt.xlabel('Fibonacci Term')
  22. plt.ylabel('Seconds')
  23. plt.show()