Removing a set of 'non-active' time intervals from a set of 'active' time intervals using a priority queue and a sweep algorithm.