Question: I need a help to solve algorithm problem! Suppose that we are to search a list of 700 million items using the Recursive Binary Search

I need a help to solve algorithm problem!

Suppose that we are to search a list of 700 million items using the Recursive Binary Search algorithm. What is the maximum number of comparisons that this algorithm must perform (i.e. the worst case) before finding a given item or concluding that it is not in the list? Please show how you arrived at your solution.

-----------------------------------------------------------------------------

Recursive Binary Search Algorithm

Problem - Determine whether x is in the sorted array S of size n.

Inputs - positive integer n, sorted (nondecreasing order) array of keys S indexed from 1 to n, a key x.

Outputs - location, the location of x in S (0 if x is not is S).

index location (index low, index high)

{

index mid;

if (low>high)

return 0;

else {

mid = [(low + high)/2];

return mid

else if (x < S[mid])

return location (low, mid -1);

else

return location (mid + 1. high);

}

}

-----------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!