Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a rod of length n inches and an array of prices (pi, for i = 1...n) of all pieces of size smaller than or

Given a rod of length n inches and an array of prices (pi, for i = 1...n) of all pieces of size smaller than or equal to n, that is pi is the price for a piece of length i inches. The Rod Cutting problem is to determine the maximum value obtainable by cutting up the rod and selling the pieces.
a) Describe a greedy algorithm to determine a set of piece sizes to cut up a rod to maximize the value when selling the pieces. For example, given p = [1, 3, 4, 5], the optimal solution would be [2, 2]. That is, a 4- inch rod is divided into two 2-inch pieces worth 3 each, for a total of
6.a) Give a set of prices for which the greedy algorithm does not yield an optimal solution. Show the solution your algorithm yields along with an optimal solution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Greedy Algorithm for Rod Cutting The greedy algorithm for the rod cutting problem is quite simple It tries to maximize the value at each step by choos... 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

Spreadsheet Modeling And Decision Analysis A Practical Introduction To Management Science

Authors: Cliff T. Ragsdale

5th Edition

324656645, 324656637, 9780324656640, 978-0324656633

More Books

Students also viewed these Algorithms questions

Question

Who should be involved?

Answered: 1 week ago