Minimum Platforms
Arrivals and departures sorted as one event list. The peak number open is the platforms needed.
Intervals and Greedy Choices: How many rooms
3 rooms. At the peak 3 meetings overlapped, so fewer rooms cannot work, and the sweep never needs more than the peak. Sorting the 2n endpoints dominates: O(n log n).
Cost
- Best
- O(n log n)
- Average
- O(n log n)
- Worst
- O(n log n)
- Space
- O(1)
Before this
A variant of
Taught by the same lesson
Intervals and Greedy Choices covers these too, in the same run.