Skip to content

Instantly share code, notes, and snippets.

@futoase
Created April 4, 2012 06:22
Show Gist options
  • Select an option

  • Save futoase/2298717 to your computer and use it in GitHub Desktop.

Select an option

Save futoase/2298717 to your computer and use it in GitHub Desktop.
quick sort
def qsort(L):
if len(L) == 1:
return [L[0]]
elif len(L) == 0:
return []
else:
return qsort([x for x in L[1:] if L[0] >= x]) + [L[0]] + qsort([y for y in L[1:] if L[0] < y])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment