Design a greedy algorithm for making change after someone


Problem

Design a greedy algorithm for making change after someone buys some candy costing x cents and the customer gives the clerk $1. Your algorithm should try to minimize the number of coins returned.

a. Show that your greedy algorithm returns the minimum number of coins if the coins have denominations $0.25, $0.10, $0.05, and $0.01.

b. Give a set of denominations for which your algorithm may not return the minimum number of coins. Include an example where your algorithm fails.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a greedy algorithm for making change after someone
Reference No:- TGS02637156

Expected delivery within 24 Hours