Problem:-
You have 8 balls. One of them is defective and weighs less than others. You have a balance to measure balls against each other. In 2 weighing, how do you find the defective one?
Solution:
Defective ball is light
Make three Groups G1 – 3 balls G2 – 3 balls G3 – 2 balls
First weight- G1 and G2 if G1 = G2 then defective ball in G3 ,
weigh the the 2 balls in G3 if EQUAL then 3rd ball of G3 is defective
else whichever lighter in 1st or 2nd is defective ball
else if G1 < G2 defective ball in G1
weigh 1 and 2 ball of G1 if EQUAL then 3rd ball of G1 is defective
else whichever lighter in 1st or 2nd is defective ball
else if G1 > G2 defective in G2
Again in 1 comparison we can find the odd ball.
So by following above steps in 2 steps, lighter ball can be find out.
No comments:
Post a Comment