Guest

If bob writes down a number between 1 to 1000 on a paper and marry have to identify that bumber and she knows that bob always tells the truth. so how many questions she will ask to determine the answer in the worst case.??? ans is. 10 but how??????????

If bob writes down a number between 1 to 1000 on a paper and marry have to identify that bumber and she knows that bob always tells the truth. so how many questions she will ask to determine the answer in the worst case.???


ans is. 10 but how??????????

Grade:12th Pass

1 Answers

Swapnil Saxena
102 Points
12 years ago

The quickest way to judge the correct answer is binary search usually used in computer sc.

Algorithm of binary search:

Step 1:Marry will ask bod that whether the no is greater than, equal to, or less than 500

Possibilities:

  • If the no is greater than 500, the next question will be whether it is equal to ,less than or greater than 750. 
  • If the no is less than 500, the next question will be whether it is equal to ,less than or greater than 250
  • If it is equal to 500 search is over

The process will went went over and over again and again till the correct no is found.The worst sitution possible is when the no lies in the extremeties, then in tht case greates no of tries r required

For ex if the no is 1 or 1000

Then the question r

Q1. whether the no is greater than, equal to or less than 500?

Q2. whether the no is greater than, equal to or less than 250?

Q3. whether the no is greater than, equal to or less than 125?

Q4. whether the no is greater than, equal to or less than 63? (For worsening the situation we choose 63 not 62)

Q5. whether the no is greater than, equal to or less than 32?

Q6. whether the no is greater than, equal to or less than 16?

Q7. whether the no is greater than, equal to or less than 8?

Q8. whether the no is greater than, equal to or less than 4?

Q9. whether the no is greater than, equal to or less than 2?

Q10. whether the no is greater than, equal to 1?

Finally in question 10 the puzzle would be resolved. 

So 10 is the correct answer.

Think You Can Provide A Better Answer ?

ASK QUESTION

Get your questions answered by the expert for free