Bonus 1

Bonus 1
Question:
Suppose we have N identical looking balls numbered 1 through N and only one of
them is counterfeit ball whose weight is different with the others. Suppose further that
you have one balance scale. Develop a method for finding the counterfeit coin with
minimum number of weighing times in worst case.
Solution:
Without loss of generality, let N = 3k + r, 0 โ‰ค r < 3. Partition N balls into four groups
A, B, C, and D, where A, B, and C each has k balls and D has r balls. Take A and B on
the left side and right side of the balance, respectively. We have the following two
results.
(1) A โ‰  B
The counterfeit ball is either in A or B. Put C and A on both sides of the balance
scale, respectively. We can find the counterfeit ball is heavier or lighter than
normal one according to the weighing result. Then the problem can reduce to how
many weighing times we can find a counterfeit ball which is lighter (heavier)
among k balls. The number of weighing times to find a lighter (heavier) ball
among k balls is โŒˆlog3 ๐‘˜โŒ‰. So, the number of weighing times is 2 + โŒˆlog3 ๐‘˜โŒ‰ =
2 + โŒˆlog3 ๐‘/3โŒ‰ = 1 + โŒˆlog3 ๐‘โŒ‰.
(2) A = B
The counterfeit ball is either in C or D. Take C and A on both sides of the balance
scale, respectively. There are two following results.
1. C = A
The counterfeit ball is in group D. If there is only one ball in D, this ball is the
counterfeit ball. If there are two balls in D, you can find the counterfeit one by
taking a ball in A and a ball in D randomly on the balance scale. So, the
number of weighing times is three.
2. C โ‰  A
The counterfeit ball is in C. Note that, we also can know the counterfeit ball is
lighter or heavier than the normal one. So, the number of weighing times is
2 + โŒˆlog3 ๐‘˜โŒ‰ = 2 + โŒˆlog3 ๐‘/3โŒ‰ = 1 + โŒˆlog3 ๐‘โŒ‰.