if i were asked a secret question between 1 and 1 billion by asking yes/no question of the form "is the number less than X?
" what algo should i use to efficiently find the secret number?
using the algo what will be the minimum number of questions if asked will guarantee to find
the secret number???
Just think of the number in in its binary representation.
What question will tell you the value of the first bit?
Knowing that, what question will tell you the value of the next bit?
How many questions will you need to know the values of all the bits?