Nib asked for
Halving Beyond Searching
Whenever you hunt for a hidden answer and each test can tell you which half holds it, you can find it in a handful of steps, whether the hunt is through numbers, software history, or ideas.
6 steps, drawn by Nib. Read it here, or watch him draw it. Updated .
1the pile
Look back at the number game. The list was just a hidden thing, a way to ask a question, and an answer that points left or right. Strip away the numbers and what remains is a pattern: a large set of possibilities, a test, and a reply that rules out one whole side. Nothing in that pattern cares that the items were numbers.
The method is a pattern, not a numbers trick: possibilities, a test, and an answer that rules out a whole side.
2bug hunt
Programmers face this when software that worked last month is suddenly broken. Between the last good version and today's broken one sit, say, 1,000 saved changes, called commits, each a small edit by someone. Checking all of them one by one would take forever. Instead, you test the middle change: does the bug appear there? If yes, the culprit is in the earlier half; if no, the later half.
A bug hunt through 1,000 changes becomes: test the middle one, then discard half.
3shrinking
Repeat, and the pile shrinks from 1,000 to 500, 250, 125, and so on. Because 2 to the 10th power is 1,024, about ten tests pinpoint the single change that introduced the bug. This is exactly the doubling logic from page 2, run backwards. Tools such as Git even automate it, under the name bisect.
A thousand suspects need only about ten tests, the doubling arithmetic run in reverse.
4good questions
The same thing happens in twenty questions. 'Is it alive?' splits the world of things into two groups. A good player picks questions that cut the remaining possibilities roughly in half each time. A poor question, like 'Is it a toaster?', only eliminates one item, the equivalent of guessing 1 in the number game.
Good questions split what remains roughly in half; poor ones peel off a single item.
5must point
Notice what made the earlier pages work, because it must hold here too. The list had to be ordered, so one test could rule out a whole side. For the bug hunt, changes are ordered in time, and the bug, once introduced, stays. Twenty questions has no strict order, so the questions themselves must do the splitting. If the test cannot tell you which side holds the answer, halving fails.
Halving needs an ordering, or questions that truly split, so one answer discards a whole side.
a common mix-upHalving works on any haystack. It only works when each test splits the possibilities evenly and tells you which half holds the target.
If a bug appears and disappears randomly depending on the change, could you still halve through the changes?
Show the answer
No. The test no longer tells you which half holds the culprit, so discarding a half is not safe.
6twenty steps
So the numbers were a doorway. Whenever you face a huge space of possibilities and can ask a question that splits it evenly and says which half holds the answer, you can shrink a million to one in about twenty steps. Learning to look for such questions is the real skill, and it applies far beyond lists.
Look for the question that splits the possibilities evenly and says which half holds the answer.
So the next time you face a mountain of possibilities, don't march through it. Ask the question that cuts it in half, and let the doubling work for you.