Quick Sort in Python
A quick implementation of qsort in python:
def qsort(a):
if not a:
return []
first = a[0]
lesser = filter(lambda i: i < first, a[1:])
greater = filter(lambda i: i >= first, a[1:])
return qsort(lesser) + [first] + qsort(greater)
Written by 灵小句
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#