Please read the new rule regarding the restriction on the use of AI tools. ×

olivergrant's blog

By olivergrant, history, 8 months ago, In English

A common D&C question is to find the non-dominated points. This can be done in $$$O(n \log n)$$$ by sorting the points by x value, splitting them in half and then finding the solution on each side. We combine them by noticing that we just need to find the right-most point that is not dominated by the right side.

Now, I'm curious to know the opposite. How can we find the dominance factor of all points? That is, how would I go about finding the number of points that dominate point $$$(x_i, y_i)$$$?

I'm thinking about something along the lines of counting inversions but cannot formalize my idea.

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
8 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Sort points by decreasing $$$x$$$. The points that dominate $$$(x_i, y_i)$$$ are the points with higher $$$x_i$$$ and higher $$$y_i$$$, so they are the points processed before $$$i$$$ and with higher $$$y_i$$$. So you can either store the $$$y_i$$$ in a Fenwick tree / PBDS, or use this type of D&C.