Skip to content
Data Structures and Algorithms / Algorithm Design Paradigms

Derivation — Exchange-Argument Proofs for Greedy Correctness

Every greedy correctness proof in this unit — Dijkstra's, the MST cut property, interval scheduling — followed the identical logical shape: assume an optimal solution doesn't make the greedy choice, then show it can be modified (an "exchange") to include that choice without making it worse. This note names that shape explicitly as the exchange-argument template, then does something the previous, more optimistic lessons haven't: applies the same reasoning attempt to a problem where it fails — 0/1 knapsack — to build the instinct for recognising when greedy is unsafe, not just when it works.

In this lesson

  1. Learning objectives
  2. The exchange-argument template
  3. Confirming the template on known-good cases
  4. Where the template fails: 0/1 knapsack

Before you start

The full lesson, with worked examples and exercise solutions, is for members.

Read the full lesson

New to SelfMadeQuant.com? See membership options or explore the curriculum.