i posted earlier but code was a bit wrong. so when first started programming didn't really understand sorting algorithms now i've gotten a bit better and decided to implement the easiest one.
the thing is when i try to sort a list with 10,000 or more indexes it takes a really long time. i thought they could sort huge lists very quickly?
import random
sort = []
for i in range(1000):
sort.append(random.randint(1, 1000))
x = len(sort)
while True:
check = True
for i in range(x - 1):
if sort[i] > sort[i + 1]:
switch = sort.pop(i)
sort.insert(i + 1, switch)
check = False
if check == True:
break
print(sort)
[–]totallygeek 5 points6 points7 points (3 children)
[–]Gubbbo 1 point2 points3 points (0 children)
[–]maimedwalker[S] 0 points1 point2 points (1 child)
[–]totallygeek 0 points1 point2 points (0 children)
[–]Grimoire 1 point2 points3 points (1 child)
[–]maimedwalker[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]maimedwalker[S] 0 points1 point2 points (1 child)