# TADM2E 2.48

From Algorithm Wiki

Revision as of 02:12, 18 February 2019 by SnowSailor (Talk | contribs)

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. Place one of the remaining balls on each side of the balance to get the answer.

If (2):

Remove all balls from the balance. Randomly select two 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 is the heavier one.

If (3):

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