Question: 6) Consider the following greedy algorithm for the rod-cutting problem i. given a remaining length of k inches, determine the value per inch for each

 6) Consider the following greedy algorithm for the rod-cutting problem i.

6) Consider the following greedy algorithm for the rod-cutting problem i. given a remaining length of k inches, determine the value per inch for each length I from 1 to k i. cut at length I which maximizes the value per inch (use the largest value of I to break ties); this produces a piece A of length I and a piece B of length k-I ili. repeat steps i and i with piece B until no more cuts are made (best i k) This greedy algorithm is not guaranteed to solve the problem optimally Give an example input that the greedy algorithm would solve sub-optimally. State both the greedy solution and the optimal solution. (7 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!