Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve it question 6 !!!! 4-Consider the problem of weighing an integer amount n using the fewest number of weight pieces. We have 4

please solve it question 6 !!!!

4-Consider the problem of weighing an integer amount n using the fewest number of weight pieces. We have 4 types of weight pieces; 1 kg, 5kg, 10kg, and 25 kg. Assume any weight piece is infinitely available. A greedy algorithm iteratively selects the largest weight piece that does not take us past the amount to be weighed, decreases the amount to be weighed by the weight of the selected piece, and continues iteratively. For instance to weigh 123 kilograms, the greedy algorithm selects the weight pieces in the following order: 25 + 25 + 25 + 25 + 10 + 10 + 1 + 1 + 1, making use of a total of 9 weight pieces. Prove or disprove whether the greedy algorithm provides the optimum solution for any value of n.

6-Consider the same problem defined in Question 4. This time give a set of types of weights for which the greedy algorithm does not yield an optimal solution. Note that your set should include 1kg weights so that there is a solution for every value of n.

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

Students also viewed these Databases questions

Question

For the standard normal density (x), show that 0(x) x(x).

Answered: 1 week ago