Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

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.

Short Answer

Expert verified

Subpart (a):

Hence, 87 cents can be changed with 3 quarters, 1 dime, and 2 pennies.

Subpart (b):

Hence, 49 cents can be changed with 1 quarters, 2 dime, and 4 pennies.

Subpart (c):

Hence, 99 cents can be changed with 3 quarters, 2 dime, and 4 pennies.

Subpart (d):

Hence, 33 cents can be changed with 1 quarters, 1 nickel, and 3 pennies.

Step by step solution

01

Subpart (a):

Step 1:

So, the conversion between U.S. coins are:

1 penny = 1 cents

1 nickle = 5 cents

1 dime = 10 cents

1 quarter = 25 cents

Step 2:

So, by greedy change algorithm 87cents can have following combinations of quarters, dimes, nickels, and pennies:

3 quarters = 75 cents

1 dime = 10 cents]

2 pennis = 2 cents

Therefore, 87 cents can be changed with 3 quarters, 1 dime, and 2 pennies.

02

Subpart (b):

Step 1:

So, the conversion between U.S. coins are:

1 penny = 1 cents

1 nickel = 5 cents

1 dime = 10 cents

1 quarter = 25 cents

Step 2:

So, by greedy change algorithm 49 cents can have following combinations of quarters, dimes, nickels, and pennies:

1quarter=25cents2dime=20cents4pennis=4cents
Therefore, 49 cents can be changed with 1 quarters, 2 dime, and 4 pennies.

03

Subpart (c):

Step 1:

So, the conversion between U.S. coins are:

1penny=1cents1nickel=5cents1dime=10cents1quarter=25cents

Step 2:

So, by greedy change algorithm 99 cents can have following combinations of quarters, dimes, nickels, and pennies:

3quarters=75cents2dimes=20cents4pennies=4cents

Therefore, 99cents can be changed with 3 quarters, 2 dime, and 4 pennies.

04

Subpart (d):

Step 1:

So, the conversion between U.S. coins are:

1penny=1cents1nickel=5cents1dime=10cents1quarter=25cents

Step 2:

So, by greedy change algorithm 33 cents can have following combinations of quarters, dimes, nickels, and pennies:

1quarters=25cents1nickel=5cents3pennis=3cents

Therefore, 33 cents can be changed with 1 quarters, 1 nickel, and 3 pennies.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free