Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonatas Emidio jonatasemidio

View GitHub Profile
@juanplopes
juanplopes / gist:2295119
Created Apr 3, 2012
Quick Sort in python
View gist:2295119
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)