Created
July 7, 2024 08:21
-
-
Save basola21/51976ef491d84060d8e509b6ef2789b5 to your computer and use it in GitHub Desktop.
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 qsort(inlist): | |
if inlist == []: | |
return [] | |
else: | |
pivot = inlist[0] | |
lesser = qsort([x for x in inlist[1:] if x < pivot]) | |
greater = qsort([x for x in inlist[1:] if x >= pivot]) | |
return lesser + [pivot] + greater |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment