Created
July 4, 2019 16:40
-
-
Save tuvo1106/a7316a03503d511dcbb7c41c27fae6d7 to your computer and use it in GitHub Desktop.
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
def quicksort(l:list) -> list: | |
arr = l[::] | |
if len(arr) <= 1: | |
return arr | |
l = [x for x in arr[1:] if x <= arr[0]] | |
r = [x for x in arr[1:] if x > arr[0]] | |
return quicksort(l) + arr[0:1] + quicksort(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment