def quickSort(alist, lo, hi):
if lo < hi:
p = partition(alist, lo, hi)
quickSort(alist, lo, p-1)
quickSort(alist, p+1, hi)
return alist
def partition(alist, lo, hi):
p = alist[lo]
L = lo + 1
R = hi
while True:
while L <= R and alist[L] <= p:
L += 1
while L <= R and alist[R] >= p:
R -= 1
if R < L:
alist[lo], alist[R] = alist[R], alist[lo]
return R
else:
alist[L], alist[R] = alist[R], alist[L]
if __name__ = '__main__':
uL = [54, 26, 93, 17, 77, 31, 44, 55, 20]
sL = quickSort(uL[:], 0, len(uL) - 1)
print(uL)
print(sL)