Practice Discrete Math

Algorithms / Greedy Exchange Arguments

Least You Need to Know: Greedy Choice, Exchange Arguments, and Local Decisions

Greedy algorithms succeed when a **locally optimal step** can be justified as part of some globally optimal solution. Exchange arguments and staying-ahead arguments explain why taking a certain next move never makes the final answer worse.

The least you need to know

Key notation

greedy choice next local step taken immediately
exchange argument swap optimal solution pieces to include greedy step
stays ahead greedy partial solution is never worse than competitors so far

Tiny worked example

  • In interval scheduling, pick the interval that finishes earliest.
  • If an optimal schedule starts with a later-finishing interval, swap that first interval with the greedy one.
  • The greedy interval leaves at least as much room for the remaining intervals.
  • So there exists an optimal schedule that begins with the greedy choice.

Common mistakes

How to recognize this kind of problem

Start practice