Question

Your friend thinks of an n-bit string (some sequence of 0s and 1s such as 01011 for n 5) that we will refer to as code. You

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I will show you an example having 5-bits which eventually generalizes to n-bits.

You start asking with all 0's as 00000. If friend answers 5, well you guessed it correct!

If answer is 0, invert each bit and get the guess correct.

If answer is between 1 to 4 some work needs to be done, but don't worry it takes less than 5 questions :)

Guess Response
00000 1
10000 0 (All places incorrect)
01111 Hurray!
10000 2 (1st place correct)
11000 1 (2nd place incorrect)
10100 3 (1,2,3 are correct)
10111 Hurray!
11000 3 (2nd place correct)
11100 2 (3rd place incorrect)
11011 Hurray!

Hence using this repetitive technique solution can be found under 5 or even n questions.

Add a comment
Know the answer?
Add Answer to:
Your friend thinks of an n-bit string (some sequence of 0's and 1's such as 01011...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT