Created
October 31, 2019 22:28
-
-
Save imedadel/689b21de783f85623e42b469efd62b25 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(arr): | |
| if len(arr) < 2: | |
| return arr | |
| pivot = arr[0] | |
| less = [i for i in arr[1:] if i <= pivot] | |
| greater = [i for i in arr[1:] if i > pivot] | |
| return quicksort(less) + [pivot] + quicksort(greater) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment