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?

🎲 Try a Random Question  |  Total Questions in Quiz: 119  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Data Structures & Algorithms Practice Test: Dynamic Programming — practice the complete quiz, review flashcards, or try a random question.

Quiz questions on dynamic programming, fibonacci using dynamic programming, coin change problem, kadane algorithm, longest increasing subsequence, rod cutting, minimum no of jumps, 0/1 knapsack problem, matrix chain multiplication, longest common subsequence, edit distance problem, wagner-fischer algorithm, balanced partition, dice throw problem and counting boolean parenthesizations. Dynamic Programming (DP) is a technique in the field of Data Structures and Algorithms that helps solve complex problems. It involves breaking down problems into smaller, reusable subproblems. DP is a principle... 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 NOT produce an optimal answer?