```
def quicksort(lst, first=0, last=None):
if last == None:
last = len(lst) - 1
if first >= last:
return
left = first
right = last
mid = lst[left]
while left < right:
while left < right and mid < lst[right]:
right -= 1
lst[left] = lst[right]
while left < right and lst[left] <= mid:
left += 1
lst[right] = lst[left]
lst[left] = mid
quicksort(lst, first, left - 1)
quicksort(lst, left + 1, last)
```

Advertisements