I am struggling to wrap my head around how the divide and conquer algorithm works for dimensions greater than 2, specifically how to find the closest pair of points between two sub-problems.
I know that I need to only consider points within a distance d
of the division between the two on the x
axis.
I know that in the 3d case I need to compare each point to only 15 others.
What I don't understand is how to choose those 15 points. In the 2d case, one simply sorts the values by y
value and goes through them in order. In the 3d case, however, each point needs to be compared to the 15 points closest to it on both the y
and z
axes. I can't seem to find a way to determine what those 15 points are in a way that doesn't have a worst case of O(n^2)
...
What am I missing here?