Summary: In practice, consider using a ray (a point and a vector) to represent the half plane on the left side of it. Then we can first sort by the angle with the positive half axis of the x-axis (which can be realized by atan2 (y, x)), and then use a double ended queue to maintain the ray currently in transit. The reason for using a double ended queue is that when a new half plane is inserted, the head and tail of the queue may be ejected, What's more, we should play the tail of the team first, then the head of the team last, and then the head of the team read the whole passage
posted @ 2019-06-20 14:15 Ressed Reading (190) Comments (0) Recommended (0) edit