Skip to content

Instantly share code, notes, and snippets.

@basola21
Created July 7, 2024 08:21
Show Gist options
  • Save basola21/51976ef491d84060d8e509b6ef2789b5 to your computer and use it in GitHub Desktop.
Save basola21/51976ef491d84060d8e509b6ef2789b5 to your computer and use it in GitHub Desktop.
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