
« : May 29, 2007, 10:54:40 PM From Shrinidhi» 

Find the defective ball! There are 12 balls. One of them is defective (Can be light or heavy). Rest of them are of equal weight and size. You are given a weighing balance. Find out the defective ball in minimum no of weighings!
PS: Needless to say this is one of the most common interview puzzle





« #1 : May 29, 2007, 11:41:52 PM From PSM» 

we wil seperate them into two halves(6+6) thenn weigh them.......now seperate lighter and heavior sides.......divide them again into two two(3+3) parts and weigh them again.....so now we r weighing 3 v/s. 3 of lighter sides and 3 v/s. 3 of heavior one...one of the two weighings willl differ........ if the difference is from lighter side then seperate the 3 lighter balls from other ......otherwise if the difference comes from...heavior side.....seperate the 3 heavior balls........
then divide the three in 2 and 1 and take one ball from other balls....then weigh again and in this way we can seperate the odd one.
we will require at maxxx 5 weighing to take that odd one out......... 1. one 6 v/s. 6 2. two 3 v/s. 3 3. one 2 v/s. 2 4. one 1 v/s.1
i.e 1+2+1+1=5




« #2 : May 30, 2007, 04:02:49 AM From kurchi» 

wht if we dividen the balls in groups of 4 and 8.we take the first 8,divide the into 4+4,and weigh,take out the lighter set,divide into two,and thus we take a total of 3 weighings however if the 4+4 weigh same,we take the second group of 4,divide them into two and weigh,and finally one against one we thus complete it in 3 weighings!




« #3 : May 30, 2007, 10:04:17 AM From PSM» 

kurchi u didint read the question right....its written that the ball can be heavy also....ur assuming the ball to be light only..... thats why u r able to complete it in just 3 weighings but if u do it again u will know according to ur way(of dividing in 4,4,4) in worst case 5 weighings has to be taken...




« #4 : May 30, 2007, 11:14:35 AM From kurchi» 

ok...rite(i thought we assume either one,and lighter or heavier was immaterial)



I think it could be made in 4 Take 4+4. Then weigh them. Remove the highest weighing one. Thenmake other 4 in it's place. If they are same then neglect those 8.If not then neglect those whose weights are equal. Now we got 4 only. Weigh 1+1. If they are equal then neglect both and find the defective from the next pair whose weight differs from the early ones. If not then remove the highest weighing one and replace with another. If they are same then the defective one is the one we removed. If they are not equal then the one which is present in it before is the defective one. So 4+4==>1 4+another 4==>2 1+1==>3 (in worst cases)1+another one==>4




« #6 : June 02, 2007, 09:37:59 PM From Shrinidhi» 

Interesting answers, but incorrect.
The minimum number of weighings that is required to do this is 3.
The question now is How?



1) First 3+3 If they are of same weight then we would get the original weight of a balls. remove those balls.Now there will be 6 balls remaining. Second 3+3 Remove the side which got the same weight.Also we could know that the ball is either heavy or light.Now there are 3 balls. Third 1+1 If they are same then the defective is the third ball.If they are not, no problem. We know the weight of the ball and so the defective ball will be found as we know that it is heavy or light.
2) First 3+3 If they are of unequal weight then remove any one side and compare with the next one. Second 3+3 If they are equal then consider the removed three balls only.If not then consider the balls that are present from the beginning. Third 1+1 Since we know the weight of the ball and found the diffrence of the original and the defectivce one, we could find the defective one in this iteration.
I have assumed that the weighing machine is electronic and so the weights of the balls can be when we compare a pair seen from it.




« #8 : June 09, 2007, 11:49:35 PM From Prateek» 

Spazinvader, that isn't 3 weighings. Maximum it will take 4.



It takes 3 weightings only on both the cases. How come it will take 4? I dont get it. Would you explain it please?




« #10 : June 17, 2007, 09:59:57 AM From Prateek» 

"Second 3+3 Remove the side which got the same weight."
How is this possible in one weighing?? Remember, you don't have a digital weighing machine. It is just an ordinary weighing machine which can be used to compare the weights.




« #11 : July 08, 2007, 12:05:48 AM From Shrinidhi» 

This is a real tricky one. Get your pen and papers out.
Out of 12 make 3 groups of 4 balls each.
Weigh Group1 and Group2
Case 1: Group1 is heavier
Take 3 balls out of Group1 and replace it with 3 balls from Group2. Add 3 balls from Group 3 to Group2. Weigh again.
Case 1a: Group1 is again heaver So the one original ball in Group1 or the one original ball in Group2 is the defective ball. Weigh the original ball in Group1 with the one in Group3 to find the defective one.
Case 1b: Group1 is lighter So the 3 balls which were moved from Group2 to Group1 are defective. Also the defective ball is lighter. Weigh 2 balls (out of 3 moved from Group2 to 1) to find the lighter one.
Case 1c: Group1 and Group2 are equal So one of the 3 balls that were moved out to Group1 is defective. Also the defective ball is heavier. Weigh 2 balls (out of the 3 balls moved out of Group1) to find the heavier one.
Case 2: Group1 is lighter. Follow the case 1a, 1b, 1c (with the heavier and lighter ones reversed)
Case 3: Group1 & Group2 weigh same One of the 4 balls of Group3 is defective. Weigh 3 balls from Group3 against 3 of any other Group (say 1). Follow steps similar to case 1a, 1b & 1c.
The defective ball can be found in 3 steps.



