Comment on Programmer tries to explain binary search to the police

<- View Parent
captain_aggravated@sh.itjust.works ⁨7⁩ ⁨months⁩ ago

Let’s use the example of a bike theft. We enter into evidence a 4-hour security cam video that shows the thief with the bike.

Scenario A: The camera can directly see the bike rack, and the bike in question is visible at the beginning of the video, and not visible at the end. Somewhere in this 4-hour video, someone walks up to the bike and takes it out of the bike rack. You can use a binary search to find the moment that happens in this video because you can pick a frame and say “Ah, this was before the theft; the bike is still there” or “ah, this was after the theft; the bike is gone.”

Scenario B: The camera can’t directly see the bike rack, but can see the doorway you have to walk through to get to the bike rack. So somewhere in 4 hours of doorway footage, someone walks through the door, then a short time later walks back through the door with the bike. A binary search won’t help here because the door looks the same at the beginning or end of the video. A simple binary search won’t work here because the door looks the same before and after.

source
Sort:hotnewtop