What is the maximum number of comparisons that a binary search function will make when searching for a value in a 1,000 - element array? How do I modify binary search to find the next smallest or next largest element if the searched element is not found in C++?