def binary_search(sorted_array: list, search: int) -> int:
    """
    Binary Search Algorithm

    Time Complexity --> O(Log N)

    :param sorted_array: list
    :param search: int

    :return index: int
    """
    low = 0
    high = len(sorted_array)

    while low < high:
        mid = (low + high) // 2

        if search < sorted_array[mid]:
            high = mid
        elif search > sorted_array[mid]:
            low = mid + 1
        else:
            return mid
    return -1