Thursday, July 23, 2009

12 ball problem

The problem is you have 12 balls (of any kind), one ball either
lighter or heavier than the other 11. A scale is provided to you but only
three weighs are allowed. How can you possibly figure out which is the odd
ball in three iterations.


click here for answer


Easy answer is as follows. it takes max 4 iterations for this:

take 6 balls on one scale and other 6 on second scale. (1)
the scales will not balance out.
take the heavier 6
weight 3 against 3 (2)
if they balance out then the ball is lighter one and is found in the other 6
balance 3 - 3 from the first set of 6 which was lighter on the scale.(3)
take the 3 balls which goes up (lighter)
balance 1 ball on left and one ball on right, keep the third ball on table. (4)
if they balance out : ball on table is the lighter ball
else, the scale which goes up has the lighter ball.
else if they do not balance out
the culprit is a heavier one.
take the 3 balls which is heavier and balance 1 against another, keep third on
table (3)
if they balance out : ball on table is the lighter ball
else, the scale which goes up has the lighter ball.


------------------------------------------------------

the efficient solution of finding the ball in 3 iterations is as follows
answer from: Games for the Super-
intelligent" by the late Jim Fixx.

Number the balls 1 to 12. Weigh 1, 2, 3, and 4 against 5, 6, 7, and 8.
If (1, 2, 3, 4) and (5, 6, 7, 8) balance:
Weigh 9 and 10 against 11 and 8 (we know 8 is not the odd ball).
If (9, 10) and (11, 8) balance: then 12 is the odd one.

Weigh 12 against any other to find out if it is heavy or light.

If (9, 10) and (11, 8) do not balance: suppose 11 and 8 are heavier,
than 9 and 10; then either 11 is heavy, or 9 is light, or 10 is light.

Weigh 9 against 10; if they balance, 11 is heavy; if they do not,
the lighter of 9 and 10 is the odd ball.

(Similar argument if 11 and 8 are lighter than 9 and 10).

If (1, 2, 3, 4) and (5, 6, 7, 8) do not balance:
Suppose 5, 6, 7, and 8 are heavier than 1, 2, 3, & 4. Then: one of
(1, 2, 3, or 4) is light, or else one of (5, 6, 7, or 8) is heavy.
Weigh 1, 2, and 5 against 3, 6, and 9.
If they balance: then either 7 is heavy, or 8 is heavy, or 4 is light.
Weigh 7 against 8; if they balance, 4 is the odd ball, otherwise the
heavier of 7 and 8 is the odd ball.

If (1, 2, 5) and (3, 6, 9) do not balance: suppose 1, 2, and 5 are lighter
than 3, 6, and 9; then either 6 is heavy, or 1 is light, or 2 is light.
Weigh 1 against 2 to find out which one of the three choices is true.
Otherwise, suppose 1, 2, and 5 are heavier than 3, 6, and 9; then either 3
is light, or 5 is heavy.

Weigh 3 against (say) 2 to find out which of the two choices is true.

(Similar argument if 1, 2, and 5 are lighter than 3, 6, and 9).

No comments:

Post a Comment