Neighbours are not enough
transcript
Sort the points by x. The nearest pair must be close. Close in the list? Not always.
The sorted neighbours are 100 and 101 apart. Comparing only them says 100. But two other points are 1 apart. They are not neighbours in the list.
Split the points at the middle. Solve both halves, and keep the smaller distance. Then check the strip near the line, in y order.
All pairs of 100,000 riders are 4,999,950,000. A split on x takes about 1,660,964 steps. The answers are equal.
Draw the coordinates from a small grid. Equal and collinear points then come up often. The neighbour trap fails at seed sixteen.
Many points can share the same x. Break those ties by y. Duplicate points have distance zero. Test all three on a small grid of points.
Neighbours in x are not enough. Check the strip in y order. Full breakdown in the lecture.