Will it fit the second
transcript
A million events. One second to process them. Which approach fits? Count before you code.
A machine does about a hundred million steps a second. That is the step budget for one second. Any approach must stay under it. Now count the steps.
Comparing every pair makes half a trillion steps. Divide by a hundred million. That is five thousand seconds. More than an hour. It does not fit.
Sorting makes nineteen million steps. Divide by a hundred million. That is under two tenths of a second. It fits, with room to spare.
The rate is only an estimate. Keep a margin of three or more. Measure the real code when close. Then ship with confidence.
Pairs are the slowest here. Sorting comes next. One pass is the fastest. Rank by class first.
Check your count with a run. Run a small size with a counter. Compare with the formula. Then trust the large size.
Count first. Then code. Full breakdown in the lecture.