I have a scenario where there are 2 regions and a set of points in both of them. There is no particular pattern amongst the points in each region (we can't consider them to be forming a convex polygon or such.)
I wish to find the shortest distance connecting a point in region 1 with a point in region 2.
Pictorially, the situation can be described as follows:
Region 1:
----------- SOME SPACE ---------------
Region 2:
I know I can use the Naive algorithm but it will be O(n^2) but I wish to know if there exists a faster approach. I feel I can sort the set of points by y coordinates and try to find distance in a particular order, but am unable to prove the correctness of such approach.
Thanks.