分而治之?看看这样如何: 1. sort the points based on some axis, to divide them rough to two parts 2. the solution is 1 of the following 4: a) on the left -> recursive call b) on the right -> recursive call c) one black on left, one white on right d) one white on left, one black on right 3. search of c and d can be constrained by the upper limit we get in a) and b)
what if you have all white on left and all black on right, then a) and b) tell you nothing about min dist between a black and a white.
and
【在 x****8 的大作中提到】 : 分而治之?看看这样如何: : 1. sort the points based on some axis, to divide them rough to two parts : 2. the solution is 1 of the following 4: : a) on the left -> recursive call : b) on the right -> recursive call : c) one black on left, one white on right : d) one white on left, one black on right : 3. search of c and d can be constrained by the upper limit we get in a) and : b)
x*y
15 楼
Is there any differene from finding 2 closest points in 2-D space, which is a classic "divide and conquer" problem?