Skip to content

Instantly share code, notes, and snippets.

View jonatasemidio's full-sized avatar

Jonatas Emidio jonatasemidio

View GitHub Profile
@juanplopes
juanplopes / gist:2295119
Created April 3, 2012 19:53
Quick Sort in python
def quicksort(V):
if len(V) <= 1:
return V
pivot = V[0]
equal = [x for x in V if x == pivot]
lesser = [x for x in V if x < pivot]
greater = [x for x in V if x > pivot]
return quicksort(lesser) + equal + quicksort(greater)