def partition(low, high, arr): index = low - 1 mid = arr[high] for i in range(low, high + 1): if arr[i] index += 1 arr[i], arr[index] = arr[index], arr[i] index += 1 arr[index], arr[high] = arr[high], arr[index] return indexdef quick_sort(low, high, arr): if low p = partition(low, high, arr) quick_sort(low, p - 1, arr) quick_sort(p + 1, high, arr)