Question: ( a ) Your friend, John, is holding an integer array A [ 1 . . n ] , and he tells you that the
a Your friend, John, is holding an integer array and he tells you that the array
is sorted, and contains all the integers from to except one. John challenges you to find
the missing integer. He allows you to ask him questions in the form:
"What is the th bit of
and he is going to answer you honestly. So you can vary the values of i and in each
question you ask him.
Design an efficient algorithm to find out the missing integer using questions.
b Now, John has changed the input, and the array A becomes unsorted. Design an
algorithm using questions to find out the missing integer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
