Say that a point in the coordinate (x1, y1) dominates another point (x2, y2) if x1 & le; x2 and y1? y2;
I have a set of points (x1, y1), .... (xn, yn), and I want to find the total number of dominant pairs. I can do this with brute force, comparing all the points against each other, but this takes O (n 2 ) time. Instead, I would like to use the divide and conquer approach to solve this in time for O (n log n).
Now I have the following algorithm:
Draw a vertical line dividing the set of point points into two equal subsets of P left and P right . As a base case, if only two points remain, I can compare them directly.
Recursively count the number of dominant pairs in P left and P right
Some conquest steps?
The problem is that I don’t see what the “win” step should take. I want to calculate how many dominant pairs there are, which crosses P left in P right , but I don’t know how to do this without comparing all the points in both parts that would take O (n 2 ) time.
Can someone give me a hint on how to take a conqueror step? 
so 2 half y coordinates: {1,3,4,5,5} and {5,8,9,10,12}
I draw a line of division.
algorithm big-o time-complexity 2d divide-and-conquer
ERJAN
source share