Construct a greedy algorithm to schedule as many as

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: using the fewest coins possible has —༉  at most 2 dimes (2×10c), 1 nickel (1×5c), 4 pennies (4×1c), —༉  cannot have 2 dimes and a nickel (2×10c + 5c), and —༉  total amount of change in dimes, nickels, pennies must not exceed 24c. Proof: by contradiction —༉  —༉  —༉  If we had 3 dimes, we could replace them with a quarter and a nickel. If we had 2 nickels, we could replace them with 1 dime. If we had 5 pennies, we could replace them with a nickel (5c). —༉  If we had 2 dimes and 1 nickel, we could replace them with a quarter. —༉  The allowable combinations, have a maximum value of 24 cents. Otherwise, we could replace them with a quarter. Proving Op$mality for US Coins Theorem: the greedy change- making algorithm for US coins produces change using the fewest coins possible. Proof: by contradiction. 1.  A...
View Full Document

Ask a homework question - tutors are online