**For Friday:**

Copy over a new file into your cs21/class/week11/ subdirectory:

$ cp ~newhall/public/cs21/week11/recbullseye.py .

**For Wednesday:**

Copy over a new file into your cs21/class/week11/ subdirectory:

$ cp ~newhall/public/cs21/week11/recursivelist.py .Or, if you did not do this on Monday, create a week11 subdirectory in your cs21/class directory and copy over my starting point files:

$ cd $ cd cs21/class $ pwd /home/your_user_name/cs21/class $ mkdir week11 $ cd week11 $ pwd /home/your_user_name/cs21/class/week11 $ cp ~newhall/public/cs21/week11/* .

- Open recursivelist.py. We are going to write a recursive version
of binarySearch,
**recursiveBinarySearch**. To come up with the idea os the recursive algorithm, we want to first think of a recursive definition of binary search:The result of binarySearch on a list is:

- the result of binarySearch on the bottom half of the list if val < list[mid]

OR - the result of binarySearch on the top half of the list if val > list[mid]

When we implement a recursive function, just like when we implement any function, we need to think about what needs to be passed to it (how many parameters and what type) and if it returns a value or not, and if so what type. The return value is easy, since we want the same return value as the iterative version of Binary Search (the index of the bucket that contains the matching value or -1 if no matching value). However, the recursive binary search may need different values passed into it to do the right thing.

We then want to think about what are the recursive step(s) and what are the base case(s) where we will stop the recursive search.

- the result of binarySearch on the bottom half of the list if val < list[mid]
- We can also think about sorting in a recursive way. We are going to think about a new sorting algorithm that uses the Divide and Conquer idea of binary search, but applied to sorting, and we will think about it in a recursive way.