def quick_sort_partition(array: list, start: int, end: int) -> int:
    """
    We will partition our array as we choose a pivot element (it will always be the last element),
    we will check the elements from the starting index to the ending index to determine which elements
    is higher than the pivot and which is lower, we will put the pivot at its correct position
    as the lower elements will be placed to the left of the pivot and the higher to the right.

    :param array: Array to be sorted.
    :param start: Starting index.
    :param end: Ending index.
    :return: Index of the pivot.
    """
    pivot = array[end]
    index_smallest_element = start - 1

    for index in range(start, end):
        if array[index] <= pivot:
            index_smallest_element = index_smallest_element + 1
            array[index_smallest_element], array[index] = array[index], array[index_smallest_element]

    array[index_smallest_element + 1], array[end] = array[end], array[index_smallest_element + 1]

    return index_smallest_element