def _rec_helper(array, start, end):
    if (start >= end):
        return
    pivot = start
    left = (pivot + 1)
    right = end
    while (left <= right):
        if ((array[left] > array[pivot]) and (array[right] < array[pivot])):
            _swap(array, left, right)
        if (array[pivot] >= array[left]):
            left += 1
        if (array[pivot] <= array[right]):
            right -= 1
    _swap(array, pivot, right)
    if ((right - start) > (end - right)):
        _rec_helper(array, start, (right - 1))
        _rec_helper(array, (right + 1), end)
    else:
        _rec_helper(array, (right + 1), end)
        _rec_helper(array, start, (right - 1))
def _rec_helper(array, start, end):
    if (start >= end):
        return
    pivot = start
    left = (pivot + 1)
    right = end
    while (left <= right):
        if ((array[left] > array[pivot]) and (array[right] < array[pivot])):
            _swap(array, left, right)
        if (array[pivot] >= array[left]):
            left += 1
        if (array[pivot] <= array[right]):
            right -= 1
    _swap(array, pivot, right)
    if ((right - start) > (end - right)):
        _rec_helper(array, start, (right - 1))
        _rec_helper(array, (right + 1), end)
    else:
        _rec_helper(array, (right + 1), end)
        _rec_helper(array, start, (right - 1))