List all the keys of this array that will require the larges

List all the keys of this array that will require the largest number of key comparisons when searched for by binary search. Find the average number of key comparisons made by binary search in a successful search in this array. Assume that each key is searched for with the same probability. Find the average number of key comparisons made by binary search in an unsuccessful search in this array. Assume that searches for keys in each of the 14 intervals formed by the array\'s elements are equally likely. Estimate how many times faster an average successful search will be in a Sorted array of one million elements if it is done by binary search versus sequential search. The time efficiency of sequential search does not depend on whether a list is implemented as an array or as a linked list. Is it also true for searching a sorted list by binary search? a Design a version of binary search that uses only two-way comparisons such as lessthanorequalto and = Implement your algorithm i

Solution

In sequential search the average number of comparisons on a successful search is n/2 where n is the number of elements in the array. Therefore to search in an array of 1,000,000 elements it takes an average of 500,000 comparisons.

On the other hand, in binary search the average number of comparisons on a successful search is (1 + 4 + 6 + 8 + ... + 40) / 1000000 = 18.

 List all the keys of this array that will require the largest number of key comparisons when searched for by binary search. Find the average number of key comp

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site