We can find non-dominated pairs at O(n log n) time.
Sort the pairs, decreasing the order of a_i , and then iterate over the pairs. In addition, keep track of the maximum value of b indicated so far, b_max . At each step, if the next (a_i,b_i) pair has a value b greater than b_max , add it to the list of answers and update b_max . The final list of answers will be non-dominated pairs.
Correctness: a pair dominates if and only if some pair has a larger a and more b . When we consider a pair, we compare its value b exactly to the maximum value of b among pairs with large a s, so we add a pair to the list if and only if it does not dominate.
Runtime: sorting pairs by value takes O(n log n) . Iteration takes O(n) time, so the total execution time is O(n log n) .
Paul S.
source share