As the other answers pointed out, the worst difficulty is O (n ^ 2).
However, there are heuristics that can help in practice. For example, if the set A is a subset of Z ^ 2 (integer pairs), then we can eliminate the set of upfront points:
- Sorting along the x axis (for a given value of x say 1, find the point with the maximum value of y, repeat for all values โโof x) to get a set of candidates maximums, call it y-maxima.
- Similarly, we get the set of x-maxima.
- Cross to get the final set of xy-maximals candidates.
This is the cost of O (n). It is easy to see that any maximal point will be present in xy-maxilla. However, it may not contain maximum points. For example, consider the set {(1,0), (0,1), (2,2)}.
Depending on your situation, this can be quite heuristic. You can follow this with a comprehensive algorithm on a smaller set of xy-maxilals.
More generally, this problem is called the Pareto Frontier calculation problem. Here are some good links:
http://www.cs.yorku.ca/~jarek/papers/vldbj06/lessII.pdf
https://en.wikipedia.org/wiki/Pareto_efficiency#Use_in_engineering_and_economics
In particular, the BEST algorithm from the first link is very useful.
akshan
source share