Question: (a) Show the sequence of steps in using a binary search to find the number 2 in the list 1, 2, 3, 4, 5, 6, 7, 8, 9. How many times is 2 compared with an element in the list? How many times would it be compared with an element in the list if we employed a linear search?
(b) Repeat (a) if we are searching for the number 7.