Hello everyone. I want your help to find an algorithm. here is the problem: We have points from a 2d space. The point (a,b) is "greater than" (c,d) iff a>c and b>d. S is a set of n points S={(Xi,Yi),i=1...n}. For every point (Xi,Yi) find the number* of points for which (Xi,Yi) is "greater".(*=just the number. not the points) The algorithm must be O(n*(logn)^2) [or O(n*logn) if we can]. (I prefer divide and conquer solution.) My thought: we have an array of points [A1,A2,A3...An]. The solution is an array of numbers [k1,k2,k3,...kn], (ki indicates the number of elements that are "less that" Ai) the algorithm divides the array in small pieces. For example [A1,A2,...Ap] and [Ap+1,...An]. suppose that we have found [k1,...kp] and [kp+1,...kn]. How can we combine the two sub-solutions to solve our problem? A possible answer is to compare each element from [A1...An] with each element from [Ap+1...An]. But his requires O(n^2) time. Any better idea?