1

Can anybody suggest an algorithm to find Pareto-optimal points (to form a staircase) just as given in diagram in O(n*h) and O(n*log(h)) time complexity, where h is the number of Pareto-optimal points?

enter image description here

I used gift wrapping algorithm to solve this (in O(n*h)), but it only finds convex hulls type of staircase and misses those points who form concave angles.

nbro
  • 15,395
  • 32
  • 113
  • 196
Mehul Parmar
  • 347
  • 4
  • 21
  • Order points decreasing by x coordinate, pick first, remove all points with y <= first... repeat until list is empty. – maraca Mar 28 '17 at 17:44
  • @maraca that's an O(n) algo. I specifically need a O(nh) and O(nlog h) algo – Mehul Parmar Mar 28 '17 at 18:48
  • Actually it's O(nh), sort is O(n logn) and then you pick h times a point and scan the remaining items, so it's something like O(nh/2)+O(nlogn) which is expressed as O(nh) if nlogn grows slower than nh. – maraca Mar 28 '17 at 19:16
  • @maraca oh even no need to sort, just choose the right most point in O(n). Start from it, choose the rightmost point from points which are less than x and greater than y of the chosen point. Thnx for help! Any idea for O(nlog h) – Mehul Parmar Mar 28 '17 at 19:25
  • Divide and conquer. Find point P with max(y) where x >= (min(x) + max(x)) / 2. That is pareto point somwhere in the middle :-) Split rest of points in three parts: right of P, left and up of P, left and down of P. Third set doesn't have pareto points. Recursively do same procedure on other two set of points. – Ante Mar 30 '17 at 22:01
  • @Ante can you explain how its O(nlog h) – Mehul Parmar Mar 31 '17 at 14:15
  • First pass trhough n elements produces 1 point, next pass through – Ante Mar 31 '17 at 14:25
  • @Ante I implemented an O(nlog n) algorithm earlier. First choose point with max(y). Ignore all points with x-coordinate less than this point and do recursion in right part. How is your algo different from this that it produces O(nlog h) instead of O(nlog n) – Mehul Parmar Apr 01 '17 at 06:00
  • @MehulParmar With max(y) you are choosing left-most pareto point. That strategy produces O(n*h), since each step chooses left-most point. Choosing middle pareto point splits problem in two smaller. Sum of points passed in these smaller problems is less than in initial problem. And these two problems produce two pareto points. With that it is O(n log(h)). – Ante Apr 01 '17 at 16:04
  • @Ante i thought choosing the maximum point with y coordinate divides all points in half we can assume that, which will give O(nlog n) as complexity. So is there any other way to get O(nlog n)? – Mehul Parmar Apr 02 '17 at 05:15
  • It would be nice if, after all this time, you know the solution to these problems, and you can share them with us, by writing a complete answer (with both algorithms) to your own question, so that people do not have to read a bunch of disorganized comments. – nbro Mar 26 '18 at 00:11

1 Answers1

1

To put suggestion in one place.

Idea is to use divide and conquer strategy. If we can find pareto point P which splits rest of pareto points in half's in O(n) than it can be done in O(n log(h)). That can be checked by splitting points in three parts right of P, left and up of P, left and down of P. Third set doesn't have pareto points. And recursively do same procedure on other two set of points. Set that three parts split points in ratio: a, b, 1 - a - b. With that complexity is:

T(n, h) = T(a*n, h/2) + T(b*n, h/2) + O(n)
       <= T(n, h/2) + O(n)
       <= T(n, h/4) + 2 * O(n)
       <= T(n, h/8) + 3 * O(n)
       <= ...
       <= O(n log(h))

Problem is finding pareto point with that characteristic in <= O(n). Some simple heuristic like P where x >= (min(x) + max(x)) / 2, probably makes very good average.

I am not sure, but I think it is possible to use k-th order statistic to find point with that characteristic. Similar to finding median as pivot in quicksort.

Ante
  • 5,350
  • 6
  • 23
  • 46