2556
Programmer tries to explain binary search to the police
(startrek.website)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Yeah, there's no reason it should take an hour no matter how long the tape is.
If you've got 14 billion years, a theft takes a minute, then you need 53 recursion levels of binary search to find the moment of the theft. (14 billion years can be split into about 7.3e15 1-minute segments, 53 levels of binary search allow you to search through 9e15 segments)
That means OP assumed that it'd take 1 minute to decide whether at a certain still frame the theft had already occured or not, to compute the new offset to seek to, and the time it'd take to actually seek the tape to that point.
Not an unreasonable assumption, but a very conservative estimate. Assuming the footage is on an HDD and you've got an automated system for binary search, I'd actually assume it'd take 5 seconds for each step, meaning finding a 1min theft on 14 billion years of footage would take 5 minutes.
According to my napkin math it would take longer than an hour if the tape was ~3.3*10^218 sec long (or three million trillion trillion... (18 trillions) ...trillion years). Assuming you have only have two options to choose between but can pick which alternative in in 5 seconds (2^720) and you want to get down to a 1 minute intervall.
So i mean its not impossible to find a tape long enough though it seems unlikely that we would be so off in our estimates of the age of the universe.