Skip to content

Instantly share code, notes, and snippets.

@c272
Created May 9, 2018 19:49
Show Gist options
  • Save c272/e5de38116d60b644e5ee3685cc06cb42 to your computer and use it in GitHub Desktop.
Save c272/e5de38116d60b644e5ee3685cc06cb42 to your computer and use it in GitHub Desktop.
The worst sorting algorithm the world has ever seen.
# The shittiest sorting algorithm on planet earth.
# @Poltroon @C272
from random import shuffle
arr = [0,12,99,13,17,19,6]
#Searching.
done = "false"
pnum = 0
while (done=="false"):
pnum+=1
shuffle(arr)
isSort = "true"
for i in range(0,len(arr)-2):
if (arr[i]>arr[i+1]):
isSort = "fail"
if (isSort == "true"):
done = "true"
else:
print("Pass "+str(pnum)+" failed.")
print("Finished pass "+str(pnum)+", successful!")
print(arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment