Created
September 7, 2017 21:23
-
-
Save bernEsp/7665136f70e0163819934627dfa2ee31 to your computer and use it in GitHub Desktop.
python quick_sort
This file contains 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
def quick_sort(array): | |
value = random.choice(array) | |
l = [] | |
r = [] | |
c = [] | |
for i in array: | |
if i < value: | |
l.append(i) | |
elif i > value: | |
r.append(i) | |
else: | |
c.append(i) | |
if len(l) > 1: | |
l = mistery(l) | |
if len(r) > 1: | |
r = mistery(r) | |
return l + c + r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment