Question: RESPONSE IN C++ 1. If a linear search function is searching for a value that is stored in the last element of a 10,200-element array,
RESPONSE IN C++

1. If a linear search function is searching for a value that is stored in the last element of a 10,200-element array, how many comparisons will the search function have to make to locate the value? 2. Given an array of 824 elements, what is the average number of comparisons a linear search function will make to locate a specific value? 3. Assume that a binary search function is searching for a value that is stored in the middle element of an array. How many times will the function read and compare elements in the array before it finds the value? 4. What is the maximum number of comparisons that a binary search function will make when searching for a value in an array that contains 2,048 elements? (Be careful, the book does not go far enough in using powers of 2 to explain the maximum numbers of comparisons needed. Especially in the case where the search value is not in the array.) 5. Why is a binary search function almost always more efficient than a linear search function? Make you explanation complete, concise, and specific. (you may even find a good explanation in our textbook.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
