text_plain_output_1.png
def binary_search_recursive(array, element, start, end):
    if start > end:
        return -1
    mid = (start + end) // 2
    if element == array[mid]:
        return mid
    if element < array[mid]:
        return binary_search_recursive(array, element, start, mid - 1)
    else:
        return binary_search_recursive(array, element, mid + 1, end)

element = 35
array = list(range(1, 1000))
n = 1000
print('Searching for {}'.format(element))
print('Index of {}: {}'.format(element, binary_search_recursive(array, element, 0, len(array))))