def binary_search_iterative(array, target):
    """
    Search target element in the given array by iterative binary search

    - Worst-case space complexity: O(1)
    - Worst-case performance: O(log n)

    :param array: given array
    :type array: list
    :param target: target element to search
    :type target: Any
    :return: index of target element, -1 for not found
    :rtype: int
    """
    # check base case
    if len(array) == 0:
        return -1
    # lower bound
    lb = 0
    # upper bound
    ub = len(array) - 1
    while lb <= ub:
        mid = lb + (ub - lb) // 2
        # if element is present at the middle itself
        if target == array[mid]:
            return mid
        # if element is greater than mid, then it
        # can only be present in right subarray
        elif target > array[mid]:
            lb = mid + 1
        # else the element can only be present
        # in left subarray
        else:
            ub = mid - 1
    return -1