Question: Suppose you are given a sorted array, A, of n distinct integers in the range from 1 to n + 1, so there is exactly
Suppose you are given a sorted array, A, of n distinct integers in the range from 1 to n + 1, so there is exactly one integer in this range missing from A. Describe an O(log n)-time algorithm for finding the integer in this range that is not in A.
Step by Step Solution
3.37 Rating (172 Votes )
There are 3 Steps involved in it
We can use binary search to find the missing integer in Olog n time We can compare the midpo... View full answer
Get step-by-step solutions from verified subject matter experts
