Exchange Argument — Transform OPT into Greedy

Minimize maximum lateness: swap adjacent inversions until OPT becomes the EDF schedule

Jobs (time:deadline)

Run the exchange

Speed

Lateness

Current max lateness
Greedy (EDF) target
Inversions left
Optimal (proved)

Log

Current schedule (starts as an arbitrary OPT, becomes EDF)

Greedy (EDF) reference — sorted by deadline
job block (width = time) the adjacent inverted pair being swapped deadline marker

Explanation

Load jobs and press Run all swaps. The top schedule begins as an arbitrary (possibly worst) order — a stand-in for an optimal schedule — and we repeatedly swap an adjacent inversion (a later-deadline job sitting before an earlier-deadline one). Each swap never increases the maximum lateness, and after finitely many swaps the schedule equals the greedy EDF order. That is the exchange argument, made visible.