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/* .
The result of binarySearch on a list is:
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.