1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ainat [17]
3 years ago
14

Suppose we need to make change for n cents, and we want to use the least number of coins of denominations 1, 10, and 25 cents. C

onsider the following greedy strategy: suppose the amount left to change is m. Take the largest coin that is no more than m, subtract this coin’s value from m, and repeat. Prove that this algorithm is optimal, or give a counterexample if it is not.
Mathematics
1 answer:
frutty [35]3 years ago
8 0

Answer:

Explained

Step-by-step explanation:

This algorithm does not always give the optimal solution.  There is an alternate method as well.

Consider we have to make change for 30 cents, using the least number of coins of denominations 1,10 and 25 cents.According to the given strategy, we first take a 25 cents coin and subtract it from 30 cents. Now, we have to make 5 cents which we can make only from 5 one-cent coins. So, the total number of coins required is 6 according to the given greedy strategy.

But we can simply use 3 ten-cent coins to make change of 30 cents. So, this example proves that the given strategy is not an optimal one.

You might be interested in
Over the weekend, Brady and Jack drove to Key West to go scuba diving. Now they're preparing to go home. Brady needs gas for his
Yakvenalex [24]
The awnser to the question is 560 miles. You are welcome
6 0
3 years ago
Read 2 more answers
Easiest way to make a ratio into percentage <br>​
GaryK [48]

Answer:

To convert a ratio into the form of a percentage

6 0
3 years ago
Read 2 more answers
If pis inversely proportional to the square of q, and p is 23 when q is 4, determine p
Misha Larkins [42]

Answer:

p\ =\ 92

Step-by-step explanation:

Given

p\ \alpha\ \frac{1}{q^2}

p =23; q=4

Required

Find p, when q = 2

We have:

p\ \alpha\ \frac{1}{q^2}

Express as equation

p\ =\ \frac{k}{q^2}

Make k the subject

k =pq^2

When: p =23; q=4

k =23 * 4^2

k =368

When q = 2, we have:

p\ =\ \frac{k}{q^2}

p\ =\ \frac{368}{2^2}

p\ =\ \frac{368}{4}

p\ =\ 92

5 0
3 years ago
Beth has a bag of apples.She gives 6 apples to Natasha.Now she has 7 left.How many apples were in the bag at first?
vlabodo [156]
15 from calculations
3 0
3 years ago
The diagram below shows the graph of which inequality??
NNADVOKAT [17]
y=less than or equal too 1
3 0
3 years ago
Other questions:
  • Which of the following inequalities have no solution?
    9·1 answer
  • What is the percent of change from 56 to 22? round to the nearest percent
    5·1 answer
  • Find the sum and then classify it.5/6+√91
    14·2 answers
  • 2+ x/-10 = 2/5 A. -16 B -24 C. 16 D. 24
    9·2 answers
  • How does the exponent of each power of ten correspond with placing a decimal
    15·1 answer
  • 50 points.<br> Please help me write a rational function that fits this graph
    12·1 answer
  • The function f is defined by f(x)=2x+5/x+4 find f (3x)
    14·1 answer
  • Find the composite area
    7·1 answer
  • Order 130 inches, 4 yards, 10 feet from greatest to least
    10·2 answers
  • Find the measure of the segment indicated.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!