You have five coins, apparently alike, but actually of different weights. You also have a two arm scale.
Can you manage to sort the coins in ascending order, using the scale only seven times?
Bonus question: can it be done in fewer weighings?
The O-Sort is a diminishing increment sorting algorithm that starts
with a step size 1 smaller than 1/2 the length of items to be sorted.
Calling the coin positions A, B, C, D, and E, the sequence of
comparisons (weighings) would be as follows(after each comparison the
lighter coin would be placed closer to A and the heavier coin closer to
1. A, C
2. B, D
3. C, E
(the step size decrements here)
4. A, B
5. B, C
6. C, D
7. D, E
This sequence guarantees a solution.
Posted by Erik
on 2004-06-01 16:50:29