Ask Question
12 December, 22:07

Suppose you have coins of denominations 1, 3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm NOT produce an optimal answer?

a) 20

b) 12

c) 6

d) 5

+3
Answers (1)
  1. 12 December, 23:07
    0
    The correct option is C

    Explanation:

    A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage with the intent of finding a global optimum.

    In this, three coins {4,1,1} will be selected to make a sum of 6. But, the optimal answer is two coins {3,3}.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Suppose you have coins of denominations 1, 3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers