Skip to content

Instantly share code, notes, and snippets.

@jxnl
Created July 23, 2014 21:05
Show Gist options
  • Save jxnl/eea358fbc5d6da0ca271 to your computer and use it in GitHub Desktop.
Save jxnl/eea358fbc5d6da0ca271 to your computer and use it in GitHub Desktop.
def qsort(xs):
if xs == []:
return xs
else:
fst, *rst = xs
sm = qsort(list((x for x in rst if x <= fst)))
lg = qsort(list((x for x in rst if x > fst)))
return sm + [fst] + lg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment