Question

Problem 4. Suppose you are given a set of small boxes, numbered 1 to n, identical...

Problem 4. Suppose you are given a set of small boxes, numbered 1 to n, identical in every aspect except that each of the first i contains a pearl whereas the remaining n − i are empty. You can have two magic wands that can each test if a box is empty or not in a single touch, except that a wand disappears if you test it on a box that is empty. Show that, without knowing the value of i, you can use the two wands to determine all the boxes containing pearls using at most no more than 2√ n wand touches. Hint: For a suitable parameter k that you choose consider using one wand on boxes 1, k, 2k, 3k, . . .; find the value i where the empty box is among (i − 1)k + 1, . . . , ik. Then use the second wand sequentially from (i − 1)k + 1 to ik − 1 to the empty box. The total number of touches will be at most: n/k + k. Then, let k = √ n (think about why this value of k; why not, e.g., let k = n 0.4 ?).

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

First use one wand on boxes 1, k, 2k, 3k,......

The smallest i for which the wand burns on box i * k indicates that the first empty box is among (i - 1) *k + 1 to i*k - 1 to find it.

The total number of touches will be at most: n/k + k

Where n/k => number of boxes for the first wand and

k => for the second wand

If we chose k to be , then we have

tha is: touches

Add a comment
Know the answer?
Add Answer to:
Problem 4. Suppose you are given a set of small boxes, numbered 1 to n, identical...
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