Derive an algorithm of convex hulls intersection with $O(n)$ time

230 Views Asked by At

You are given two sets of points in the plane, the red set $R$ containing $n_r$ points and the blue set $B$ containing $n_b$ points. The total number of points in both sets is $n = n_r + n_b$.

Give an $O(n)$ time algorithm to determine whether the convex hull of the red set intersects the convex hull of the blue set. If one hull is nested within the other, then we consider them to intersect.

My approach: I think that simple finding $\min_x B = \min_{i = 1, ..., n_b} b_x, b \in B$. Same way for y-coordinate, same way for max for x-coordinate, for y-coordinate, and same way for $R$ set. But it seems too head-on, requires a lot of "if" stations, etc.

Maybe there is some better way?