Question
A greedy algorithm is used to make change for a given amount using a set of coin denominations. For denominations {1, 5, 10, 25} and an amount of 30, it works correctly. However, for denominations {1, 4, 6} and an amount of 8, it fails to find the optimal solution (e.g., 4+4 vs 6+1+1). What is the fundamental reason for this failure, which is a common debugging point for greedy algorithms?
Solution
The correct answer is B
More IT Operating System Questions
- A function sum_matrix_elements(matrix, R, C) is designed to sum all elements of a matrix with R rows and C columns. The implementation uses nested loops: ...
- A C function print_matrix(int rows, int cols, int matrix[rows][cols]) is designed to print a matrix. #include void print_matrix(int rows, int cols, ...
- Which is best fit for blank space 15?
- SLA stands for :
- cyber attack in which a malicious actor aims to render a computer or other device unavailable to its intended users by interrupting the device's normal fun...
- Quick Sort, another Divide and Conquer algorithm, partitions an array around a pivot. The choice of pivot can significantly impact its performance. What is...
- Which of the following is NOT a direct benefit of encapsulation?
- If receiver noise floor is 2 dB, signal-to-noise ratio is 3 dB then what is the receiver sensitivity?
- Β How many participating entities are there in an n-ary relationship where n=5?
- What is the primary benefit of polymorphism?