Sorting algorithms/Quicksort: Difference between revisions

m
→‎{{header|Python}}: : un-pythonic to have "else:" after "if condition: … return", as superfluous.
imported>MM
m (→‎{{header|Python}}: : un-pythonic to have "else:" after "if condition: … return", as superfluous.)
Line 8,016:
if len(arr) <= 1:
return arr
else:pivot = arr[0]
for i pivot =in arr[0]:
forif i in< arrpivot:
if less.append(i < pivot:)
elif i > less.append(i)pivot:
elif more.append(i > pivot:)
more.append(i)else:
else:pivotList.append(i)
less = quickSort(less)
pivotList.append(i)
lessmore = quickSort(lessmore)
return less + pivotList more =+ quickSort(more)
 
return less + pivotList + more
 
a = [4, 65, 2, -31, 0, 99, 83, 782, 1]
a = quickSort(a)</syntaxhighlight>
</syntaxhighlight>
 
In a Haskell fashion --
Anonymous user