Greedy Algorithms8 sections · 316 units
Open in Course

Exchange Argument Structure

The template

Here is the formal structure of an exchange argument: Claim: The greedy solution G is optimal. Proof: Let OPT be any optimal solution. I will show OPT can be transformed into G without losing optimality. 1.1. Find the first position ii where OPT and G differ.

2.2. Let G choose item gg and OPT choose item oo at position ii.

3.3. Construct a new solution OPT' by swapping oo for gg in OPT.

4.4. Show that OPT' is valid and has quality >= OPT.

5.5. OPT' agrees with G on one more position. Repeat until OPT' = G. Since G can be reached from any OPT without losing quality, G is optimal.