Activity Selection
GreedyEasySelect the maximum possible compatible activities scheduling.
Configuration Panel
Sorted Activity Selection Timeline (Track 0 selected, Track 1 discarded)
Time Complexity
Space Complexity
The Activity Selection problem selects the maximum number of mutually compatible activities that can be performed by a single person or resource, assuming start and end times are given.
Always select the next compatible activity that finishes earliest (end time is minimized), leaving the maximum time remaining for subsequent activities.
If we select activity A1 with earliest finish time, the optimal global solution consists of A1 plus the optimal solution to the subproblem of activities starting after A1 finishes.
Proof by contradiction / exchange argument: suppose another optimal choice does not select the earliest finishing activity. Replacing its first activity with the earliest finishing one cannot increase overlaps, preserving optimality.