Home > other >  Straight line dividing line segment set?
Straight line dividing line segment set?

Time:12-31

Give a line segment set S, there are n lines, any given a straight line L, whether linear L line segment set S in the space?

"Separation" means each line segment in the S are all in the side of the line L, L and straight with no a line segment intersection, below blue line separating red line segment set



Now required to do the collection S preprocessing, and then to a straight line, any query whether "separation" time complexity as logn.

How to make pretreatment excuse me? Give a thought can be ~
I wish you all a happy New Year!

CodePudding user response:

If after pretreatment, you can put all the inside of the S line, into L as X, or Y axis coordinate system in line, and sorted, then binary search, the time complexity is O (LOGN)

CodePudding user response:

reference 1/f, the truth is right or wrong response:
if after pretreatment, can put all the inside of the S line, into L as X, or Y axis coordinate system in line, and sorted, then binary search, the time complexity is O (LOGN)

L is random, that is, can give a lot of L do judgment, each judge is logn, but pretreatment can only make once
  • Related