def partition(arr,si,ei):
    """This takes a array and two indices, si and ei, and returns the index of the pivot element

    Args:
        arr (list): list to partition
        si (int): start index of list
        ei (int): end index of list
    """
    pivot = arr[ei]
    i = si
    for j in range(si,ei):
        if arr[j] <= pivot:
            arr[i],arr[j] = arr[j],arr[i]
            i += 1
    arr[i],arr[ei] = arr[ei],arr[i]
    return i