Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find the odd ball

Status
Not open for further replies.

mm0000

IS-IT--Management
May 19, 2002
295
IN
This is a variation of 'The Odd Pill' thread but much tougher to solve.

You are given 12 balls identical in appearance, however one ball is heavier or lighter than the rest. In 3 weighings, using a balance scale, find out which ball has a different weight and whether it is heavier or lighter than the rest. You are allowed to label the balls.


 
First you take 6 balls and weigh them. If they are hevier you throw them out. Else you keep them.

Then you take the six remaining balls and split them in half.
You see which is heavier.

Then you pair one of the balls in the heavier group with one of the balls in the unknown group. And you weigh against another pair of heavier and unknown. If the scale tips either way you have your answer. If it is even it is the ball you have not checked.

Process of elimitnation!

\/
00|00
00|00
00|00

\/
0|0
0|0
0|0

*0<-could be the answer
---
0|0<-these two are not weighted.
---
00<-
 
Or just weigh two of the last 3, and if the scale tips in any direction, you have your answer.

If it does not....the one you didnt weigh is the answer..
 
I'm not following why you would throw away half of the balls if they were heavier. The problem states that one of the balls is a different weight to the others, and that you have to work out which one it is and whether it is lighter or heavier than the rest. It's got me stumped!


Geraint

The lights are on but nobody's home, my elevator doesn't go to the top. I'm not playing with a full deck, I've lost my marbles. Barenaked Ladies - Crazy
 
I have arbitrarily decided lighter ball is odd.

The answer is reversible if it is heavier.
 
If you try to work the problem,
you will see that the scale solves it for you.

There has to be an attempt to weigh too supposidly equal amounts to solve each step.

Get into the problem and you can solve it.

If you dont try, you never will.
 
Code:
[COLOR=white]
Weigh any four against any other four.

Two cases:
If in balance, then the false ball is one of the remaining four (Case 1).
If not balance then the balls can be labelled H or L for possibly heavy or possibly light (Case 2).

Case1:
Weigh two of the remaining unknown balls against one unknown and one good ball.

Three cases:
If in balance, then the false ball is the remaining (12th) ball.  Weigh it against a known good ball to see whether it is light or heavy. (Case 1.1)
If balance tips left, then the balls can be labelled H, H, L and G. (Case 1.2)
If balance tips right, then the balls can be labelled L, L, H and G. (Case 1.3)

Case 1.2: weigh the H against the H.  If either one is actually heavy, that is the false ball and it is heavy.  If the scale balances, the remaining L is the false ball and it is light.

Case 1.3: similar to case 1.2 first weighing L against L.


Case2:  We have eight balls labelled H, H, H, H, and L, L, L, L for possibly light or heavy--- and 4 known good balls.

Second weighing: H, H, L against H, L, G (any of the four balls known to be good because they were not in the first weighing).
Three cases:
Balance (case 2.1)
Tips left (case 2.2)
Tips right (case 2.3)

Case 2.1:
Third weighing: Take the two possibly light balls which were not involved in the second weighing and weigh them against each other.  Either one is false and light or they balance in which case we now know the possibly heavy ball which was not involved in the second weighing is false and heavy.

Case 2.2
Third weighing: Weigh the two possibly heavy balls from the left-hand pan against each other.  Either one of them is false (and heavy) or the "L" from the right-hand pan is false (and light).

Case 2.3
Third weighing: Weigh the two possibly light balls from the right-hand pan against each other.  Either one of them is fals (and light) or the "H" from the left-hand pan is false (and heavy).

[/color]

 
>I have arbitrarily decided lighter ball is odd.

Which means that you are answering a completely different (and much simpler) problem
 
First some abbreviations: W1, W2, W3 = Weighing # 1, 2, 3 & Tag balls with characters 'A' through 'L', then
W1 ABC-DEF means: weigh balls A,B,C on left scale and D,E,F on right one. Weighing results: LU = left scale up, LD = left scale down, EQ = equilibrium.
My solution:
(Indentation for next weighing, ':' for next step, same weighing/outcome as in preceding line is left blank)

W1 ABCD-EFGH, EQ: W2 IJK-ABC EQ: W3 L-A EQ: (impossible)
LU: L lighter
LD: L heavier
LU: W3 I-J EQ: K lighter
LU: I lighter
LD: J lighter
LD: W3 I-J EQ: K heavier
LU: J heavier
LD: I heavier
LU: W2 ABE-FCI EQ: W3 G_H EQ: D lighter
LU: H heavier
LD: G heavier
LU: W3 A-B EQ: F heavier
LU: A lighter
LD: B lighter
LD: W3 C-L EQ: E heavier
LU: C lighter
LD: (impossible)
LD: W2 ABE-FCI EQ: W3 G_H EQ: D heavier
LU: G lighter
LD: H lighter
LU: W3 C-L EQ: E lighter
LU: (impossible)
LD: C heavier
LD: W3 A-B EQ: F lighter
LU: B heavier
LD: A heavier

(3 weighing outcomes are impossible, as expected:
3*3*3-3 = 12*2)

Explan. Row #10,11,12: D lighter, H heavier, G heavier:
W1 ABCD-EFGH, LU: IJKL are regular, W2 ABE-FCI EQ: ABCEF are regular, leaving DGH. W3 G-H EQ: GH are regular, so W1 means D is lighter, by the other two results of W3 D is regular, so W1 means either G or H is heavier, determined by W3.

Explan. Row #22,23,24:
W1 ABCD-EFGH, LD: IJKL are regular, W2 ABE-FCI LU: DGH are regular, so only one of ABCEF is irregular, compared to W1 balance was tipped other way round, and only CE switched scale, so either E is lighter or C is heavier, which is why
W3 C-L LU is impossible, and accounts for the outcome of rows 22 & 24.

I leave you guys to work out the rest, or did I give away too much already? :)
 
A. Find the odd group, using 3 groups of 4 balls
(let groups = G1, G2, G3)

[tt]W1: G1 v G2
/ \
Equal Not Equal
| |
G3 is odd |
|
W2: G1 v G3
/ \
Equal Not Equal
| |
G2 is odd G1 is odd[/tt]


B. Find odd ball, using odd group determined
(let balls = B1, B2, B3, B4)

[tt]W1: B1 v B2
/ \
Equal Not Equal
/ \
B3 or B4 is odd B1 or B2 is odd
| |
| |
W2: B1 v B3 B1 v B3
/ \ / \
Equal Not Equal Equal Not Equal
| | | |
Odd ball: B4 B3 B2 B1[/tt]


A. Finding the odd group took either 1 or 2 weighings

B. Finding the odd ball in the odd group took 2 weighings

Total: Either 3 or 4 weighings

Max Hugen
Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top