Recursive Binary Search

Write a program binary_search_recursive.py that:

  1. begins with the sorted list l = [1, 2, 3, 4, 7, 9, 13, 14, 20]
  2. asks for a search item
  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 None 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 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