def quickSort(alist):
    """
    Quick sort algrithm, In-place version.
    """

    def partition(alist, left, right):
        pivot = alist[right - 1]
        i = left - 1
        for j in range(left, right):
            if alist[j] < pivot:
                i += 1
                (alist[i], alist[j]) = (alist[j], alist[i])
        if alist[right - 1] < alist[i + 1]:
            (alist[i + 1], alist[right - 1]) = (alist[right - 1], alist[i + 1])
        return i + 1

    def sort(alist, left, right):
        if left < right:
            storeIndex = partition(alist, left, right)
            sort(alist, left, storeIndex)
            sort(alist, storeIndex + 1, right)
    sort(alist, 0, len(alist))
    return alist