Question: You are given a sorted array A[1 .. n] of keys, and another key x which is stored somewhere in A. Show how to find

 You are given a sorted array A[1 .. n] of keys,

You are given a sorted array A[1 .. n] of keys, and another key x which is stored somewhere in A. Show how to find the index k so that A[k] = x in time O(1+ log k). (Note k is not given, and can be much smaller than n). (b) Same, but now find k in time O(1 + log(min{k, n - k})

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!