×
×

# Show that the greedy algorithm for making change for n

ISBN: 9780073383095 37

## Solution for problem 36E Chapter 3.3

Discrete Mathematics and Its Applications | 7th Edition

• Textbook Solutions
• 2901 Step-by-step solutions solved by professors and subject experts
• Get 24/7 help from StudySoup virtual teaching assistants

Discrete Mathematics and Its Applications | 7th Edition

4 5 1 283 Reviews
21
0
Problem 36E

Show that the greedy algorithm for making change for n cents using quarters, dimes, nickels, and pennies has O(n) complexity measured in terms of comparisons needed.

Step-by-Step Solution:

Step 1</p>

In this problem, we are asked to show that the greedy algorithm for making change for n cents has O(n) complexity measured in terms comparisons needed.

Step 2</p>

The algorithm for making changes for n cents using quarters, dimes, nickels and pennies are

Procedure change

for i=1 to n

di=0

while

{is the number of coins of denominations ci }

Step 3 of 3

#### Related chapters

Unlock Textbook Solution