[Verse 1]
Schedule packed with tasks colliding, conflicts everywhere
Each activity has start and finish, time slots we must share
Greedy algorithm wisdom, earliest finish takes the crown
Sort by endpoint chronology, never let me down
Pick the first that completes soonest, mark that slot as mine
Eliminate what overlaps, draw that boundary line
[Chorus]
Activity selection, optimal and clean
Earliest finish first, the sharpest machine
No overlap permitted, intervals discrete
Maximal set discovered, algorithm complete
Sort by finish time, then greedily choose
Activity selection, you never can lose
[Verse 2]
Prove this greedy choice is optimal, induction shows the way
If our first pick isn't perfect, swap it out today
Any other starting choice will finish just as late
Or later than our greedy pick, sealing up its fate
Subproblem independence, each choice stands alone
Recursive structure emerges, patterns clearly shown
[Chorus]
Activity selection, optimal and clean
Earliest finish first, the sharpest machine
No overlap permitted, intervals discrete
Maximal set discovered, algorithm complete
Sort by finish time, then greedily choose
Activity selection, you never can lose
[Bridge]
Conference rooms and processors
Meeting halls and bandwidth streams
Time complexity linear when sorted
O of n fulfills our dreams
Dynamic programming overkill here
Greedy cuts right to the bone
[Verse 3]
Scan from left examining endpoints
Compatible means no collision
Previous selection's finish must precede
Current contender's ignition
Update your last chosen endpoint
Increment that counter high
Maximum activities captured
Efficiency amplified
[Chorus]
Activity selection, optimal and clean
Earliest finish first, the sharpest machine
No overlap permitted, intervals discrete
Maximal set discovered, algorithm complete
Sort by finish time, then greedily choose
Activity selection, you never can lose
[Outro]
Greedy stays ahead proving optimality
Resource allocation, scheduling reality