Input:
A 2-dimentional space of size MxN .
K points(integer pair) in this 2 dim space.
Output:
A point xj, yj from set of K points such that dist(i,j) in minimum where xi, yi is the current point.
dist(i,j) : is root mean square distance
Given K << M*N, K~M, K~N, M~N
Expected time complexity:
- O(M*N) for each query is definitely not enough.
- O(K) for each query is also not enough.
- Anything better than this will be acceptable.