import time
import random
import matplotlib.pyplot as plt

nvalues = [100, 500, 1500, 2000, 2500, 3000]

timesSorted = []
timesSort = []

for i in nvalues:

    random.seed()
    p = 12**2
    liste = []
    
    for x in range(i): liste.append(random.randint(0, p))

    c = liste.copy()
    a=time.perf_counter()
    triSorted = sorted(c)
    b=time.perf_counter()
    timesSorted.append(b-a)

    c = liste.copy()
    a=time.perf_counter()
    triSort = c
    triSort.sort()
    b=time.perf_counter()
    timesSort.append(b-a)

plt.plot(nvalues, timesSorted, "g-", label="Tri 1")
plt.plot(nvalues, timesSort, "b-", label="Tri 2")
plt.xlabel("Taille du jeu de données")
plt.ylabel("Temps")
plt.legend(loc="upper left")
plt.title("Comparaison des performances des algorithmes de tri")
plt.show()