You have 19 eggs. 18 of them have the same weight and 1 of them is different, but you do not know if it is heavier or lighter than the others.
Using the best possible strategy, in the worst case scenario, how many weighings do we need to perform in order to correctly identify the different egg?
Edit: You do not necessarily need to find if the egg is heavier or lighter than the others.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Did the same thing man... great answer. :D
well explained
I think a better challenge is: If instead there are 13 eggs (12 of them having the same weight) would you still need 4 weighings, or would 3 suffice?
Log in to reply
Assuming there's no known neutral egg, you need 4 weighings. There are 26 possible cases; you need to split it in three groups. However, since "heavier than" and "lighter than" are interchangeable in the first weighing, it's impossible to have a split of 9/9/8; all groups' sizes must be even, so the best you can do is 10/8/8. Now the 10 needs 3 more weighings.
Log in to reply
You do not need to determine if the odd one out is lighter or heavier. That reduces the 10 case just enough to make it possible.
The problem says "You do not necessarily need to find if the egg is heavier or lighter than the others." Because of this, there are only 19 cases, and only 3 weighings are necessary. You added an extra step to determine if the odd egg is heavier or lighter than the normal eggs.
Log in to reply
If you can find it in only 3 weighings I'd be interested to hear. Despite the fact that you don't need to find if the egg is heavier or lighter, you will need to use it to some extent in order to figure out. For example, suppose the first weighing is 5-5; if they end up unbalanced, you have 10 suspects (either one of the 5 eggs in the heavy side is heavier, or one of the 5 eggs in the light side is lighter), not 5 suspects. 10 suspects can't be solved in 2 weighings alone.
Let us assume the faulty egg is heavier.
i tried 6, 6, 6, & +1
2 weighs will give the heavier pile in the worst case.
then break in 2, 2, 2
2 more weighs will give the heavier pile...
then 1 more weigh will give the heavier egg.
Log in to reply
You don't know if the egg is heavier or lighter; that's part of the problem.
Log in to reply
ya.. the first 2 weighs wd identify that...
my process of segmentation ws a little wrong.
1 + 2 +1 if the grp of 7 is special 1 + 1 + 1 if a grp of 6 is spcl
I Think 3 weighing is sufficient. Justification :
Divide the eggs in the group of 6,6,7. Weigh the 6,6 group.
Case 1: The two group weigh equal (1 weigh done). It implies the remaining 7 has the heavy egg. Now take the seven and divide it into 3,3,1. Now Weigh the 3,3 set (2 weigh done) . If they settle equally=> implies the left out is the odd man (This is the minimum set i.e 2 weighs ). Now Consider one of the 3,3 set is unequal. Take the heavier set and pick any 2 and weigh them (3 weigh done). you would get the heavy egg depending on if both settle equal or any one pulls the balance done. Hence max iteration is 3.
Case 2: If any one of the 6 set eggs weigh down (1 weigh done ). Implies => Discard the remaining seven and other lighter set of 6 eggs. Take this 6 eggs. Divide into 3,3. Weigh them (2 weigh done). One will definitely pull the balance down. Take this heavy set of 3 eggs and weigh any 2 egg (as earlier case: 3 weighs done) and you will get the odd man.
Hence either way : Max is 3
Isn't that assuming from the beginning that the 'wrong egg' is heavier? No such assumption in the problem
Log in to reply
It hardly matters, bcoz same problem applicable even its lighter.. machine shows different reading.
I thought the same at first, but it is 4 indeed. You do not know if the special egg is heavier or lighter so you will not be able to take the heaviest group or the lighter group when u find it.
Log in to reply
but it doesn't matter because if the special egg is lighter the balance will go up otherwise down.
Log in to reply
He said: Case 1: The two group weigh equal (1 weigh done). It implies the remaining 7 has the heavy egg . Now take the seven and divide it into 3,3,1. Now Weigh the 3,3 set (2 weigh done) . If they settle equally=> implies the left out is the odd man (This is the minimum set i.e 2 weighs ). Now Consider one of the 3,3 set is unequal. Take the heavier set and pick any 2 and weigh them (3 weigh done). you would get the heavy egg depending on if both settle equal or any one pulls the balance done. Hence max iteration is 3.
When he says to us Take the haevier set he assumes the odd one is heavier, we do not know if the heavier set is the odd, or if it is the lighter one.
I originally thought 3 as well, but knowing whether it is heavier or lighter does matter. When you measure the 6 against the 6, if you then go with the heavier side you may have just lost the different "lighter" egg in the other 6, in which case your next measurement would be equal and you would be left with another egg that is equal. You have to determine heavier or lighter to know whether to take the heavy or light side in future weighings.
I took these lines from your solution only; " Take the heavier set and pick any 2 and weigh them (3 weigh done)"
My question: How can you take the heavier one without balancing you are neglecting one measurement there.
solution: change the line by " Take the heavier set(3 weigh done) and pick any 2 and weigh them (4 weigh done)".
Hope you like it :) thus max answer = 4
Log in to reply
For {1st plate}-{2nd plate} (Aside), 1st: 6-6 (7) 2nd: 3-3 or 3-3 (1) 3rd: 1-1 (1)
Separate the eggs into groups of 5, 5, 5, and 4. Call them A, B, C, D.
First, weigh A and B (weighing 1). Then weigh A and C (weighing 2). There are scenarios that can arise from here:
This means that the odd egg must be in group D.
This means that the odd egg must be in group C.
This means that the odd egg must be in group B.
This means that the odd egg is in group A.
If the egg is in group A, B, or C, we can use a single example to describe all of them because they are all groups of 5. But first, if the egg is in group D:
Group D
Label the four eggs w, x, y, and z. First, weigh w and x (weighing 3). Then, weigh w and y (weighing 4).
This means that the odd egg is egg z. Notice that we don't have to identify whether the egg is heavy or light.
This means that the odd egg is egg y.
This means that the odd egg is egg x.
This means that the odd egg is odd w.
For all scenarios in which the egg is in group D, we have 4 weighings.
Group A, B, or C
If the egg is in any of these groups, we know whether the egg is light or heavy, since we know how each group weighed in comparison to the others. The egg is in a group with 4 other eggs. Label these eggs as v, w, x, y, and z. First, weigh eggs v and w against eggs x and y (weighing 3).
This means that the egg is egg z.
You know whether the egg is heavy or light. Thus, pick the group of two with the different egg. Weigh these two eggs against each other (weighing 4).
Wait, no, this doesn't happen :P
This weighing should never be equal. You can now identify which egg is lighter or heavier than the other, and thus you can identify which egg is the odd egg.
We did this again in 4 weighings.
Thus, this algorithm can identify the egg in a maximum of 4 weighings.
So how do you prove that 3 weighings aren't sufficient?
The problem is incomplete, as it does not indicate whether the weighing happens through a balance or a spring scale. I solved the problem assuming the spring scale option, because of the wording in the problem, and I ended up with five instead of four. You should rewrite it to avoid confusion, or create two separate versions of the problem for the two different weighing instruments.
Such a nice clear answer to read.
Take out 1 egg out of 19. 18 Left. 9 9 (1st weighing) if = that 1st egg we took out was heavier else take the heavy pile of 9 eggs & take out 1 egg again (8 Left) 4 4 (2nd weighing) if = last egg which we took out was heavier else take the heavy pile of 4 eggs & divide into 2 2 2 (3rd weighing) cant be equal take heavier pile of 2 eggs & divide into 1 1 1 (4th weighing) REST YOU CAN :P Thank You
You don't know if the egg is heavier than the others. It could be lighter.
Why not divide it into 3 3 3 when using 2nd weighing. If one of the group is heavier or lighter, we divide it into 1 1 1 when using 3rd weighing. So we just use 3 weighing
Not clear, depends if this is a balance or a scale.
Shouldnt it work out with 3? 1) 6-6-7 compare groups containing 6 eggs 2) 2-2-3 (assuming that in the first trial both groups were equal; otherwise the groups would be 2-2-2) compare the groups containing 2 eggs 3) we are left with 2 eggs and compare them --> so just 3 weighings are needed
i only need 1 weighing.... i will weight 1 and see how heavy it is,then i'll add another one without taking off the first one and see if it is double the weight....then keep adding eggs one by one until i see the weight did not increase as it should..this way i will only use the weighing machine once. so 1 weighing needed!
Problem Loading...
Note Loading...
Set Loading...
Note that there are 1 9 ⋅ 2 = 3 8 possible cases. As every weighing gives lo g 2 3 bits of information (there are three possibilities: left is heavier, balanced, right is heavier), we need ⌈ lo g 2 3 lo g 2 3 8 ⌉ = 4 weighings in the worst case.
This is also easily achievable, mostly because of having only 3 8 cases to distinguish while we can distinguish 3 4 = 8 1 cases.
Divide the eggs into groups of 6, 6, and 7, and weigh the two groups of 6 against each other.
If they balance, then the group of 7 has the odd egg and the two groups of 6 have normal weights. Weigh 7 normal eggs against the offending group of 7; this will tell whether the odd egg is heavier or lighter than normal.
If they don't balance, then the group of 7 is clear. Weigh 6 normal eggs against the heavier side of the previous weighing. If they balance, then the other group of 6 has the odd egg and it's lighter; if they don't, then the current group of 6 has the odd egg and it's heavier.
So after two weighings, we manage to figure out a group of at most 7 eggs containing the odd egg, and whether the odd egg is heavier or lighter. To make things easier, add normal eggs to this offending group so there are 9 suspected eggs, and assume that the egg is heavier; if it's lighter, reverse all meanings of heavier and lighter.
Now we have 9 eggs, one of them is heavier than the rest. This is a simple ternary search: divide the eggs into groups of 3 and compare any two of them. This will tell which group of 3 has the odd egg. Next, take any two eggs from the offending group of 3; this will tell the odd egg in 4 weighings.