AlgoScope

Minimum Platforms

AlgorithmintermediateGreedy

Arrivals and departures sorted as one event list; the peak number open is the platforms needed.

Decision · step 2 of 14Intervals and Greedy Choices: How many rooms
012345678910abcdefaaabbbccccdddeeeeffft

t = 0: a starts, taking a room. Open meetings: 1. That is a new maximum, so at least 1 rooms are needed.

Open in the player →or start at step 2

What you will see

Same sweep with trains.

How intervals and greedy choices works →

Cost

BestO(n log n)
AverageO(n log n)
WorstO(n log n)
SpaceO(1)

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

A variant of

Taught by the same lesson

Intervals and Greedy Choices covers these too, in the same run.