TADM2E 2.48

From Algorithm Wiki
Jump to: navigation, search

Randomly select 6 of the balls. Place 3 balls on one side of the balance and the other 3 on the other side. There are three possible outcomes:

1. The balance doesn't lean towards one side (all the balls are the same weight)

2. The balance leans left (the heavier ball is on the left side)

3. The balance leans right (the heavier ball is on the right side)

If (1): You know that one of the 2 balls that were not on the balance must be the heavier one. Compare the 2 remaining balls on the balance to get the answer.

If (2): Remove all balls from the balance. Randomly select 2 of the balls from the left side of the balance and compare them on the balance. If the balance leans one way, you get the answer. If the balance doesn't lean at all, the remaining ball not on the balance is the heavier one.

If (3): Same as if (2), but use the 3 balls from the right side.