Skip to content

Instantly share code, notes, and snippets.

@ishankhare07
Created November 24, 2017 09:37
Show Gist options
  • Save ishankhare07/94a2ada759c0b4156bcc0a57aa7a5cba to your computer and use it in GitHub Desktop.
Save ishankhare07/94a2ada759c0b4156bcc0a57aa7a5cba to your computer and use it in GitHub Desktop.
erlang style functional quick sort
def qsort(l):
if not l:
return []
else:
pivot, tail = l[0], l[1:]
return qsort([x for x in tail if x < pivot]) + [pivot] + qsort([x for x in tail if x >= pivot])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment