Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following greedy strategy for the rod cutting problem: define the density of a rod of length i to be p/i, that is,
Consider the following "greedy" strategy for the rod cutting problem: define the density of a rod of length i to be p/i, that is, its value per inch. The greedy strategy for a rod of length n cuts off a first piece of length i, which has the maximum density. It then continues by applying the greedy strategy to the remaining piece of length n - i. a. Write pseudocode for this Greedy strategy for Rod Cutting Problem b. Fill out the density values in the following table Length i (inch) Price (dollar) Density 1 2 a 13. 20 5 21 a 24 c. According to the greedy strategy, if we are to cut a rod of length 6, what is the length of the first piece to cut off? What is the resulting revenue of the greedy solution? Is this the maximum revenue amongst all possible ways of cut (You can represent a way of cut by summation expression, e.g., 6 = 1 + 2 + 3, etc) d. If we are to cut a rod of length 5, what is the solution given by the greedy strategy? (represent it with a summation expression). Does it give the maximum revenue? If not, what is optimal way to cut?
Step by Step Solution
★★★★★
3.40 Rating (153 Votes )
There are 3 Steps involved in it
Step: 1
Lets address each part of the question stepbystep a Write pseudocode for this Greedy strategy for Rod Cutting Problem Here is a simple pseudocode for ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started