b) give a set of coin denominations for which the greedy algorithm does not yield an optimal solution. your set should include a penny so that there is a solution for every value of n. [2 points]

Respuesta :

Assume that the coins are worth {1, 3, 4} and that the amount to be changed is 66. The greedy solution would lead to the accumulation of {1, 1, 4}, whereas the ideal answer would be {3, 3}.

A greedy algorithm chooses the best option that is currently available to solve a problem. It is unconcerned with whether the current best result will produce the final, ideal result.

Even when a decision is made incorrectly, the algorithm never goes back and changes it. It functions from the top down.

For all the problems, this greedy algorithm might not yield the best outcome. It does this because it consistently chooses the option that will result in the best global outcome.

The Benefits of a Greedy Approach:

  • The algorithm is simpler to explain.
  • Compared to other algorithms, this one can perform better.

Learn more about Greedy algorithm, here

https://brainly.com/question/13197481

#SPJ4