Skip to content

Instantly share code, notes, and snippets.

@supercavitation
Created September 16, 2013 00:49
Show Gist options
  • Save supercavitation/6575610 to your computer and use it in GitHub Desktop.
Save supercavitation/6575610 to your computer and use it in GitHub Desktop.
Help! Where's the error?
def quickSortMath(values):
if len(values)<=1:
return values
if len(values)==2:
if values[1]<values[0]:
values[0],values[1]=values[1],values[0]
return values
pivot=min(values)+(sum(values)/len(values))
print pivot
less=[]
greater=[]
for x in values:
if x<=pivot:
less.append(x)
else:
greater.append(x)
## less=quickSortMath(less)
## greater=quickSortMath(greater)
return less+greater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment