Skip to content

Instantly share code, notes, and snippets.

@kundzi
Created February 12, 2015 07:34
Show Gist options
  • Select an option

  • Save kundzi/38c42fac630af2c1eabe to your computer and use it in GitHub Desktop.

Select an option

Save kundzi/38c42fac630af2c1eabe to your computer and use it in GitHub Desktop.
def qsort(xs):
if len(xs) < 2: return xs
lq = qsort([x for x in xs[1:] if x <= xs[0]])
gt = qsort([x for x in xs[1:] if x > xs[0]])
return lq + xs[0:1] + gt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment