Binary Search (Recursive)

Write a program recursive_binary_searcher.py that:

  1. begins with this sorted list l = [1, 2, 3, 4, 7, 9, 13, 14, 20]
  2. identifies a search item (key = 13, for example)
  3. calls a function 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.
  4. The function should return the index if the item is found, or -1 if it is not found.
  5. The main() program should out the location of the search item, if it exists. Otherwise, print out a "search item not found" message.
  6. Test your recursive_binary_searcher.py with the same lists and values.

Example Output:

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                  -1
[1, 2, 3, 4, 7, 9, 13, 14, 20]      23                  -1
[1, 2, 3, 4, 7, 9, 13, 14, 20]      10                  -1
[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                   -1
[4, 7, 9, 13, 14, 20]               10                  -1
[4, 7, 9, 13, 14, 20]               22                  -1