Assume your points are (xi,yi)
- find point with
min(xi)
with O(n)
and name it minX_point
- find point with
max(xi)
with O(n)
and name it maxX_point
- find point with
min(yi)
with O(n)
and name it minX_point
- find point with
max(yi)
with O(n)
and name it maxY_point
now consider rectangle which boxes these 4 point (with horizontal and vertical edges)
the diameter of this rectangle is bigger or equal to D(P) because all of P points are boxed in it.
the diameter of rectangle is as following
Rec_Diameter=sqrt((minX-maxX)^2+(minY-maxY)^2)
now find max((mixX-maxX),(minY-maxY))
the maximum would be your desired point for example maxX_point
and minX_point
because if the distance be less than D(P)/2
then we have
Rec_Diameter=sqrt((minX-maxX)^2+(minY-maxY)^2) < sqrt((D(P)/2)^2+(D(P)/2)^2)=D(P)/sqrt(2)
which Rec_Diameter>=D(P) < D(P)/sqrt(2)
is not true