I was given a array R of n rectangles [each element in the array is a bottom left point(x1,y1) and a top right point (x2,y2)] , parallel to the axis, and an array P of n points [each element is a point (x.y)].
I need to write an algorithm that finds a point in the P array that appears in the largest amount of rectangles from the R array. Complexity required is O(n*logn) I know about the concept of point of maximum overlap but this refers only to the x-axis i.e. http://www.geeksforgeeks.org/find-the-point-where-maximum-intervals-overlap/
How do I find a point of maximum overlap that fits both axis?
I thought about using a sweeping line, but I don't know how it fits the required complexity.
any ideas?
Thanks.