Simulate the line sweep algorithm for finding line segment intersections. You must manage the event queue and neighbour structures.

Line sweep is a common approach in solving different problems
algorithmically. It is used a space is searched for something, eg.
intersection points of lines or polygons or closest pair of points in
a set. It can be used in thinning algorithms, map overlay, label
placement algorithms etc.

The basic idea is to imagine a line that sweeps over the area and
handles the objects when they are encountered. This reduces the amount
of events that are needed to handle. Currently handled points are kept
in a neighbour structure.

In this implementation of line sweep the sweep line moves according to
the y-axis. Therefore, the events points (line segment endpoints and
intersection points) are kept in an priority queue according to their
**y-coordinate** (if two points have the same y-coordinate the one with smaller x-coordinate has higher priority). The priority queue used in this exercise is a binary heap.

The neighbour structure tells which line segments are next to each other in
the current line sweep position. The line segments are arranged in the neighbour structure according to the x-coordinate of the point where they intersect the sweep line. In this exercise the neighbour structure is
shown as an array. Typical implementations will use, for example, balanced binary
trees for storing the neighbour relations.

Intersection points discovered are shown in the line segment view. The intersections
will appear in the window when the algorithm discovers them (when the two intersecting
line segments are neighbours in the neighbour structure). Intersections can be inserted to
the priority queue by dragging them from the line segment view to the header of priority
queue.

Elements can be dragged from the priority queue to the neighbour structure. A new element
can be added to the structure by dropping it over the desired index. The other elements in the
table will be adjusted to make room for the new structure. Elements
already in the structure can be swapped by dropping one element on top of the other.
Elements can be deleted from the neighbour structure by dragging from the structure.

Elements can be dragged from the priority queue to the output. New element can
be added to the output by dropping it on the output header.