I\'ve got a class representing an interval. This class has two properties \"start\" and \"end\" of a comparable type. Now I\'m searching for an efficient algorithm to take t
Use the sweep line algorithm. Basically, you sort all the values in a list (while keeping whether it's beginning or end of the interval along with each item). This operation is O(n log n). Then you loop in a single pass along the sorted items and compute the intervals O(n).
O(n log n) + O(n) = O(n log n)