Hey there! We receieved your request
Stay Tuned as we are going to contact you within 1 Hour
One of our academic counsellors will contact you within 1 working day.
Click to Chat
1800-5470-145
+91 7353221155
Use Coupon: CART20 and get 20% off on all online Study Material
Complete Your Registration (Step 2 of 2 )
Sit and relax as our customer representative will contact you within 1 business day
OTP to be sent to Change
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??????????
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:
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.
Get your questions answered by the expert for free
You will get reply from our expert in sometime.
We will notify you when Our expert answers your question. To View your Question
Win Gift vouchers upto Rs 500/-
Register Yourself for a FREE Demo Class by Top IITians & Medical Experts Today !