Algorithms and Data Structures for Programming Contests

Greedy Algorithms

Discussion

What is it?

Example: making change

Input:
Coin denominations 1 = d1 < d2 < ... < dN; amount A.
Output:
Exact change for A, using as few total coins as possible.

Algorithm

Problem

Solution?

How do we know when greedy will work?

Try it!

Regroup


© Copyright 2012–2015 François Pitt <francois.pitt@utoronto.ca>
last updated at 08:24 (EST) on Thu 5 Mar 2015
Creative Commons License Algorithms and Data Structures by François Pitt is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.