You are on page 1of 4

Homework#1

Optional
(not mandatory)
Lecture#3
Instruction

Problems: Counting Money Example 1&2

Understand problems
Analyze based on PAC & HIPO charts
1 problem will be able to earn 2 participation
points (1 point for PAC + 1 point for HIPO)

Source: [25] 2
Problem Solving Process

Example #1: Counting Money


Suppose you want to count out a certain amount of money, using the fewest possible US bills
and coins
US monetary system: $100, $20, $10, $5, $1, 25¢, 10¢, 5¢, 1¢
Example: To make $56.39, what should you do?
 At each step, take the largest possible bill or coin that does not overshoot
 two $20 bills, to make $40
 a $10 bill, to make $50
 a $5 bill, to make $55
 a $1 bill, to make $56
 a 25¢ coin, to make $56.25
 a 10¢ coin, to make $56.35
 four 1¢ coins, to make $56.39
 For US money, this algorithm always gives the optimum solution
Source: [25] 3
Problem Solving Process

Example #2: Counting Money


Suppose you want to count out a certain amount of money, using the fewest possible coins
Fictional monetary system: $12, $8, $1 (coins)
Example: To make $17, what should you do?
 At each step, take the largest possible bill or coin that does not overshoot
 a $12 coin, to make $12
 five $1 coins, to make $17
 This algorithm needs six coins and is NOT the optimum solution
The better way is to use:
 two $8 coins, to make $16
 a $1 coin, to make $17
 This way we need ONLY three coins, and it is the optimum solution

Source: [25] 4

You might also like