If there are 30 cans out of them one is poisoned if a person tastes ve...
Have 6 mice for testing,
Give each mice contents from 5 cans each
5 5 5 5 5 5
After 14 hours, one of the mice will die
So, we will know which 5 cans must have the poison
Then , take the contents of these 5 cans and give to the remaining 5 mice each.
We will know in due time which can is poisoned
5C1+5C2+5C3+5C4 = 5 + 10 + 10 + 5 = 30
View all questions of this testIf there are 30 cans out of them one is poisoned if a person tastes ve...
Have 6 mice for testing,
Give each mice contents from 5 cans each
5 5 5 5 5 5
After 14 hours, one of the mice will die
So, we will know which 5 cans must have the poison
Then , take the contents of these 5 cans and give to the remaining 5 mice each.
We will know in due time which can is poisoned
5C1+5C2+5C3+5C4 = 5 + 10 + 10 + 5 = 30
If there are 30 cans out of them one is poisoned if a person tastes ve...
Solution:
Given:
- There are 30 cans, out of which one is poisoned.
- If a person tastes a very little amount from the poisoned can, they will die within 14 hours.
- There are mice available for testing.
- There are 24 hours to test.
To find the poisoned can, we can use a binary search approach. This approach involves dividing the available cans into two equal halves and testing them using the mice. Based on the result, we can narrow down the search area until we find the poisoned can.
Algorithm:
1. Start with two mice.
2. Divide the cans into two equal halves and label them as Set A and Set B.
3. Use the first mouse to taste a little amount from the cans in Set A.
4. If the mouse dies within 14 hours, it means the poisoned can is in Set A. Otherwise, the poisoned can is in Set B.
5. Repeat the process with the remaining mice, dividing the respective set into two equal halves and testing them.
6. Continue this process until only one can is left, which will be the poisoned can.
Explanation:
1. Initial division:
- Number of cans: 30
- Set A: 15 cans (labelled A1 to A15)
- Set B: 15 cans (labelled B1 to B15)
2. First test:
- Use the first mouse to test Set A.
- If the mouse dies, it means the poisoned can is in Set A (cans A1 to A15).
- If the mouse survives, it means the poisoned can is in Set B (cans B1 to B15).
3. Second division:
- Number of cans: 15
- Set A (if the first mouse died): 7 cans (labelled A1 to A7)
- Set B (if the first mouse survived): 7 cans (labelled B1 to B7)
4. Second test:
- Use the second mouse to test the respective set.
- If the mouse dies, it means the poisoned can is in that set.
- If the mouse survives, it means the poisoned can is in the other set.
5. Final division:
- Number of cans: 7 (if the first mouse died) or 7 (if the first mouse survived)
- Repeat the process of dividing and testing until only one can remains.
6. Final result:
- Continue dividing and testing until only one can is left.
- The last can tested will be the poisoned can.
Therefore, to find the poisoned can, only one mouse is required.