Created
May 9, 2018 19:49
-
-
Save c272/e5de38116d60b644e5ee3685cc06cb42 to your computer and use it in GitHub Desktop.
The worst sorting algorithm the world has ever seen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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