Greedy Algorithms8 sections · 316 units
Open in Course

Example - Activity Selection Exchange

Proving earliest-end-first

Let me prove that earliest-end-first is optimal for activity selection using exchange argument.

Setup: Activities have start and end times. Goal: select maximum non-overlapping activities. Greedy strategy: Always pick the activity that ends earliest among those that do not conflict with already-selected activities.

Claim: This greedy strategy is optimal. I will show any other solution can be transformed into this one without losing activities.