recategorized by
513 views
4 votes
4 votes
Bob writes down a number between 1 and 1,000. Mary must identify that number by asking "yes/no" questions of Bob. Mary knows that Bob always tells the truth. If Mary uses an optimal strategy then she will determine that answer at the end of exactly how many questions on the worst case?
  1. 999
  2. 500
  3. 32
  4. 10
recategorized by

2 Answers

0 votes
0 votes

Though in Question it is not Clearly said that whether Mary asks to Bob that chosen number is lesser or greater (which was written by Bob)
But in question it is clearly said that Mary uses optimal strategy, Mary would have done like below mention approach:

(Mary chooses a number and asks to Bob whether is it right number, if Bob answers YES or NO.(assume Bob answers NO for worst case condition) Then again Mary asks to Bob whether is it greater?, Bob can answer YES or NO. If Bob says YES then Mary divides the Chosen number by 2 else multiply by 2 something like this....in recursive way)

Hence it is like Binary Search Algorithm and Mary asks two questions in each step:
In worst Case total question asked by Mary = 2 x log2(1000) ≈ 20

But in Option Answer is given assuming Mary asks questions only one time in Each Step...!

Answer:

Related questions