Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coins come in a variety of values and weights. Consider a set of n coins, where each coin i has a specific value vi and

Coins come in a variety of values and weights. Consider a set of n coins, where each coin i has a specific value vi and a weight wi . All values are distinct. All input numbers are positive integers. When giving change that adds to a specific total T, we want to minimize the total weight of the coins given. The number available of each coin is unlimited. \

(a) Design and write, in pseudocode, a dynamic programming algorithm that will, given the information about n coins (values {vi} and weights {wi}) and a change amount T to be given, find the minimum total weight of coins whose values will add to exactly T (if such a set exists).

(b) Adapt your algorithm from (a) to find the number to be given of each coin that together produce the minimum.

(c) Analyse the running time of your algorithm from (a).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago