Activity Selection Visualization
The Activity Selection problem is a classic greedy algorithm problem. The goal is to select the maximum number of non-overlapping activities from a set, always picking the next activity that finishes earliest.
How Activity Selection Works
- Sort all activities by their finish time.
- Select the first activity (with the earliest finish time).
- For each subsequent activity, if its start time is after or equal to the finish time of the last selected activity, select it (cyan).
- Repeat until all activities are considered.
Cyan: Selected activity | Yellow: Current activity