i have a challenge, you want try?
Rule: create a sorting program that is the fastest and has the fewest iterations, that person will have the highest rank and absolutely DO NOT USE the sort() and sorted() functions
Y has 512 elemet
Layout:
import matplotlib.pyplot as plt
import random, time
def y():
temp = []
for _ in range(512):
temp += [random.randint(1, 512)]
return temp
X = range(1, 513)
Y = y()
ax = plt.subplot()
ax.bar(X, Y)
loop = 0
t1 = time.time()
while Y != range(1, 513):
plt.pause(0.5)
plt.draw()
"""Your code"""
loop += 1
t2 = time.time()
timer = t2 - t1
print("Time: ",timer," Loop: ",loop)
plt.show()