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 produce an optimal answer?

🎲 Try a Random Question  |  Total Questions in Quiz: 417  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Design and Analysis of Algorithms (DAA) Practice Test Questions — practice the complete quiz, review flashcards, or try a random question.

An Algorithm is a set of well-defined instructions designed to perform a specific set of tasks. Algorithms are used in Computer science to perform calculations, automatic reasoning, data processing, computations, and problem-solving.  We design an algorithm before we write the program code because the algorithm explains the logic of how the program will perform tasks. Design and Analysis of Algorithms (DAA) requires prior knowledge of basic programming and mathematics concepts and data structure concepts. Key topics related to DAA are: Introduction to Algorithm, Greedy algorithm, linked... Show more

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 produce an optimal answer?