mirror of
https://github.com/iritmaximus/tira.git
synced 2026-10-12 19:13:47 +03:00
28 lines
608 B
Python
28 lines
608 B
Python
from random import randint
|
|
from time import time
|
|
|
|
|
|
def main():
|
|
n = 10**5
|
|
randList = [randint(1, n) for x in range(n)]
|
|
|
|
start_time = time()
|
|
for i in range(1, n):
|
|
j = i - 1
|
|
while j >= 0 and randList[j] > randList[j + 1]:
|
|
temp = randList[j]
|
|
randList[j] = randList[j + 1]
|
|
randList[j + 1] = temp
|
|
j -= 1
|
|
# print("at sorting", j)
|
|
|
|
print("at round", i, "out of", n, " -- left", n - i)
|
|
end_time = time()
|
|
|
|
print(randList)
|
|
print("total time:", end_time - start_time)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|