Share
Explore BrainMass

Discrete Mathematics and its Applications : Greedy Algorithms

Greedy Algorithms

procedure change (c1, c2, ...., cr: values of denominations of coins, where c1 > c2 > ... > cr; n: a positive integer)
for i : = 1 to r
while n ≥ ci
begin
add a coin with value ci to the change
n :=n - ci
end

2. Use the greedy algorithm to make change using quarters, dimes, nickels, and pennies for:
a) 87 cents.
b) 49 cents.
c) 99 cents.
d) 33 cents.

Please see the attached file for the fully formatted problems.

Attachments

Solution Preview

Hello and thank you for posting your question to Brainmass!

The solution is attached below in two Word XP ...

Solution Summary

Greedy Algorithms are investigated. The solution is detailed and well presented.

$2.19