Skip to content

Instantly share code, notes, and snippets.

@papachristoumarios
Last active March 12, 2017 15:51
Show Gist options
  • Save papachristoumarios/1d7a0d849f5ac2e47f27 to your computer and use it in GitHub Desktop.
Save papachristoumarios/1d7a0d849f5ac2e47f27 to your computer and use it in GitHub Desktop.
Beautiful quicksort with functional syntax
#quicksort with lambda
qsort = lambda L: L if len(L) <= 1 else qsort( [ lt for lt in L[1:] if lt < L[0] ] ) + [ L[0] ] + qsort( [ ge for ge in L[1:] if ge >= L[0] ] )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment