Greedy Algorithms

Greedy algorithms: taking the locally best choice at every step, proving it with an exchange argument, and disproving it with a counterexample.

  • 8 cards
  • 4 questions
  • About 21 min
  • Intermediate to Advanced
Share

A greedy algorithm builds its answer one choice at a time, always taking the choice that looks best now and never undoing it. The topic opens on that method and the two properties that make it correct, using change for 68 cents as the first instance, then walks earliest-finish scheduling through six meetings. A gotcha shows plausible greedy rules failing and how one small counterexample proves it. An exchange argument then proves the scheduling rule correct, swap by swap, and a concept card shows that the key a greedy algorithm sorts by is its real design decision, with the right key for three goals. A code card gives two greedy schedules in three languages, and an exercise loads a van by value per kilo, where the rule works for loose goods and fails for boxes.

Contents

8 cardsnot started