Xavier Holt added Line_Segments_Algorithm_and_Runtime__.md  about 8 years ago

Commit id: ea52d555bf66bf68074db46444f03d79728345e0

deletions | additions      

         

# Line Segments  ## Algorithm and Runtime  - `H` \(\Leftarrow\) Heap  - For segment `i` by ascending x-coordinate: O(n)  - Pop `h` from `H` until `i` can hit `h` or `H` is empty: RTP amortised O(1).  - Emit index of `h` or 0 in the empty `H` case: O(1).  - Push `h` followed by `i` onto `H`: O(1).