Sort, then use the two ends
transcript
Pick pairs of servers to get the widest gaps. Which pairs? Try them all? There is a shortcut.
Sort the readings first. The two lowest are one and four. The two highest are five and nine.
The highest two make fourteen. The lowest two make five. Fourteen minus five is nine.
Pair each low value with a high one. Every such pairing gives nine. So no pairing is built.
Sort once. Add the k highest, subtract the k lowest. Readings reach ten to the nine, so use sixty-four bits.
A hundred thousand readings sort in a blink. Then one pass adds both ends. No search is left.
Write a slow twin that tries every pair. Run both on short random lists. Stop at the first difference, and shrink it.
A hundred thousand readings have five billion pairs. Two sums need only one pass after the sort.
Sort once. Then use the two ends. Full breakdown in the lecture.