Skip to content

Instantly share code, notes, and snippets.

@tuvo1106
Created July 4, 2019 16:40
Show Gist options
  • Save tuvo1106/a7316a03503d511dcbb7c41c27fae6d7 to your computer and use it in GitHub Desktop.
Save tuvo1106/a7316a03503d511dcbb7c41c27fae6d7 to your computer and use it in GitHub Desktop.
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