Binary search with no list.
transcript
No list. No array. Think of a friend saying higher or lower. Binary search still works. Search the answers themselves.
Files must upload in nine hours. Each file takes its size over the rate, rounded up. Find the slowest rate that fits. A hundred thousand files, asked every night.
Here are the hours at rates one to fourteen. A faster rate never needs more hours. At most nine hours? No, thirteen times. Then yes at rate fourteen, and for ever. That is the shape from the first lesson.
This test is a feasibility check. It asks whether one rate works. It flips once, so we can binary search. The check is one pass over the files.
The lowest rate is one. The largest file's rate surely works. At that rate every file takes one hour. So the answer sits in between.
Try the middle rate. Cut away half. Twenty-four checks replace ten million tries. Full breakdown in the lecture.