Nearest paired algorithm for comparing points from two different arrays

I would like to compare points from one array with points from another array and find the closest pair. So far, all I came across is a single array. I do not want to compare points from the same array. The brute force algorithm works, but it is too slow. Is there an algorithm or implementation for this using the divide and conquer methods?

EDIT 1: A point is defined as a pair (latitude, longitude) on the surface of the earth.

+4
source share
2 answers

kd- , . O (n log n) avarage (n - ). kd-, .

+3

kd-tree, octo tree, rtree, rtree *. O (log n) . rtree boost

+1

All Articles