Programmer tries to explain binary search to the police

The Picard Maneuver@startrek.website to Programmer Humor@programming.dev – 2488 points –
409

You are viewing a single comment

Binary search only works on sorted data, i.e. you know which side of the mid point is pointing towards the incident. If the incident leaves no trail, you can't know whether you can discard the left side or the right side, making it a complicated linear search at that moment.

If the incident leaves no trail, you can’t know whether you can discard the left side or the right side

There's a moment where the bike is there, then another when its not. The whole video, either way, will either from the beginning up to the point of theft have the bike there, or NOT have the bike there from the point of theft to the end of the video. The marker is the removal of the bike from the video lens.

But the comment you replied to wasn't talking about bike thefts specifically, it was talking about unspecified situations that don't leave traces. You responded to someone saying that binary search doesn't work in situations that don't leave cues not by arguing against the premise (e.g. "but no such event exists, everything leaves cues"), but by telling them that you simply have to look for the cues from the hypothetical event that didn't leave any.

but by telling them that you simply have to look for the cues from the hypothetical event that didn’t leave any.

And my point is that the DID leave a clue that a binary search would pick up on, the disappearance of the bike.

But it didn't, because if it did then it would fall under the second paragraph of their comment, where they said that binary search would be useful. The comment isn't just talking about bike thefts.

The comment isn’t just talking about bike thefts.

The OP is, as well as binary searches. Both are being discussed.

The OP is, but the comment you replied to isn't. They expanded on the original post, and said that while binary search is useful in that situation (along with many others), it would be useless in other situations.