PP 20
This was a great exercise! The first part, searching a list, was extremely simple. However, implementing a binary search was more complicated than I had initially thought! The difficult part for me was realizing that I had to consider the list values and the list indexes separately. Once I figured that part out I was able to write a function that I could call recursively to find the numbers IN the list. The problem at this point, was that any numbers outside the list would cause an infinite series of recursive calls. After working in circles for a while I took a break, and when came back, the answer was obvious.
All I had to do was add guardrails around the maximum and minimum values in the list. Since the list is already ordered, I assume this doesn’t add much processing time and is a reasonable and necessary step to take. After that, my solution worked perfectly!
Here is result: