Write a program binary_search_recursive.py
that:
l = [1, 2, 3, 4, 7, 9, 13, 14, 20]
search()
recursively so that it performs a Binary Search for that item in your list. The search function should include parameters arr
for the list of numbers, value
for the search term, lower
for the lower bound of the search space, and upper
for the upper bound of the search space.None
if it is not found.main()
program should out the location of the search item, if it exists. Otherwise, print out a "search item not found" message.Test your program with these lists and values
List to search Item to look for Expected result
[1, 2, 3, 4, 7, 9, 13, 14, 20] 7 4
[1, 2, 3, 4, 7, 9, 13, 14, 20] 1 0
[1, 2, 3, 4, 7, 9, 13, 14, 20] 20 8
[1, 2, 3, 4, 7, 9, 13, 14, 20] -2 None
[1, 2, 3, 4, 7, 9, 13, 14, 20] 23 None
[1, 2, 3, 4, 7, 9, 13, 14, 20] 10 None
[4, 7, 9, 13, 14, 20] 9 2
[4, 7, 9, 13, 14, 20] 13 3
[4, 7, 9, 13, 14, 20] 20 5
[4, 7, 9, 13, 14, 20] 2 None
[4, 7, 9, 13, 14, 20] 10 None
[4, 7, 9, 13, 14, 20] 22 None