Binary Search That Helps in Real Life

-

When a tool fails, you can lose an entire day debugging it. But the cause is often surprisingly simple. Can we save time with a little math? Use binary search. You can find the culprit in O(logn2) time.

Git Bisect

When working with git, atomic commits are helpful because you can use git bisect.

Screenshot of a game menu with shuffled order

I once fixed a bug where the menu order got shuffled (PR). With binary search, I found the culprit in 30 minutes. Changing a vector to a set caused it. I wasted time asking GPT because there were too many commits. Smaller commits would have helped.

VSCode Extension Bisect

Since the previous day, the input box overlapped every time I typed Korean. I rebooted and tried different IMEs, but nothing worked. Then I remembered VSCode can bisect extensions.

The culprit was the last extension I installed, which conflicted with the IME. Removing it fixed the issue.