Sedgewick & Wayne · §4.2 Sorting and Searching

Weighing an Object on a Balance

Same questions, same answers, same binary digits as converting a number to binary — only now they're asked with a two-pan scale and a set of 64, 32, 16, 8, 4, 2, 1-unit weights instead of a number line.
77
weights kept on the pan, read off as binary
Weighing log
Press “Ask” to place the first weight on the pan.

At each step a new weight (half the remaining uncertainty) goes on the left pan alongside whatever's already been kept there. If the pan is still lighter than the object, the weight stays and the beam tips toward the object; if the pan overshoots, the weight comes back off. Seven such weighings, using 64+32+16+8+4+2+1, can pin down any object between 0 and 127 units.