This repository was archived by the owner on Nov 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComplexity.py
71 lines (63 loc) · 2.38 KB
/
Complexity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import matplotlib.pyplot as pyplot
from Fibonacci import *
from Time import *
def complexity_iterative(times, iterations):
pyplot.figure()
pyplot.title("Evolution du temps de calcul en fonction du nombre de termes")
pyplot.plot(iterations, times)
pyplot.ylabel("Temps pour 10000 calcul")
pyplot.xlabel("Nombre de termes calculé")
pyplot.grid()
pyplot.show()
def complexity_recursive(times, iterations):
pyplot.figure()
pyplot.title("Evolution du temps de calcul en fonction du nombre de termes")
pyplot.plot(iterations, times)
pyplot.ylabel("Temps pour 1 calcul")
pyplot.xlabel("Nombre de termes calculé")
pyplot.grid()
pyplot.show()
def complexity_iterative_super(times, iterations):
pyplot.figure()
pyplot.title("Evolution du temps de calcul en fonction du nombre de termes")
pyplot.plot(iterations, times)
pyplot.ylabel("Temps pour 10000 calcul")
pyplot.xlabel("Nombre de termes calculé")
pyplot.grid()
pyplot.show()
def complexity_fib():
times, iterations = iteratif_lineair_time()
complexity_iterative(times, iterations)
times, iterations = recursif_time()
complexity_recursive(times, iterations)
times, iterations = iteratif_super_time()
complexity_iterative_super(times, iterations)
def complexity_tri_insertion(times, numbers):
pyplot.figure(1)
pyplot.title("Evolution du temps de tri en fonction de la taille du tableau à trier (tri_insertion")
pyplot.plot(numbers, times)
pyplot.ylabel("Temps (s)")
pyplot.xlabel("Taille du tableau")
pyplot.grid()
pyplot.show()
def complexity_tri_bulles(times, numbers):
pyplot.figure(2)
pyplot.title("Evolution du temps de tri en fonction de la taille du tableau à trier (tri_bulle)")
pyplot.plot(numbers, times)
pyplot.ylabel("Temps (s)")
pyplot.xlabel("Taille du tableau")
pyplot.grid()
pyplot.show()
def complexity_tri_comptage(times, numbers):
pyplot.figure(3)
pyplot.title("Evolution du temps de tri en fonction de la taille du tableau à trier (tri_comptage)")
pyplot.plot(numbers, times)
pyplot.ylabel("Temps (s)")
pyplot.xlabel("Taille du tableau")
pyplot.grid()
pyplot.show()
def complexity_tri():
time_b, time_i, time_c, numbers = tri_time()
complexity_tri_bulles(time_b, numbers)
complexity_tri_insertion(time_i, numbers)
complexity_tri_comptage(time_c, numbers)