binarySearch()
    left = 0
    right = n
    while left < right
        mid = (left + right) / 2
        if A[mid] == key
            return mid
        else if key < A[mid]
            right = mid
        else
            left = mid + 1
    return NOT_FOUND