Meeting Rooms
Minimum rooms = maximum number of simultaneous meetings; sweep sorted starts and ends.
Decision · step 2 of 14Intervals and Greedy Choices: How many rooms
t = 0: a starts, taking a room. Open meetings: 1. That is a new maximum, so at least 1 rooms are needed.
What you will see
A sweep line crosses sorted endpoints; a counter rises on starts and falls on ends.
Cost
| Best | O(n log n) |
|---|---|
| Average | O(n log n) |
| Worst | O(n log n) |
| Space | O(n) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.
Screen readers: Candidates announce their key and state (candidate, chosen, rejected); each step announces the local choice and its consequence.
Reduced motion: Chosen and rejected states crossfade; no travelling emphasis.
Before this
Related
Taught by the same lesson
Intervals and Greedy Choices covers these too, in the same run.