.Problem 1 Show, by means of a counterexample, that the following "greedy" strategy does not always determine an optimal way to cut rods. Define the density of a rod of length i to be pi/i, that is, its value per inch. The greedy strategy for a rod of length n cuts off a first piece of length i, where 1 ≤ i ≤ n, having maximum density. It then continues by applying the greedy strategy to the remaining piece of length n-i.

icon
Related questions
Question

Please solve the following problem and show all work (this class is analysis of algorithms we use cpp psuedocode mostly) 

 

.Problem 1
Show, by means of a counterexample, that the following "greedy" strategy does
not always determine an optimal way to cut rods. Define the density of a rod of
length i to be pi/i, that is, its value per inch. The greedy strategy for a rod of
length n cuts off a first piece of length i, where 1 ≤ i ≤ n, having maximum
density. It then continues by applying the greedy strategy to the remaining piece of
length n-i.
Transcribed Image Text:.Problem 1 Show, by means of a counterexample, that the following "greedy" strategy does not always determine an optimal way to cut rods. Define the density of a rod of length i to be pi/i, that is, its value per inch. The greedy strategy for a rod of length n cuts off a first piece of length i, where 1 ≤ i ≤ n, having maximum density. It then continues by applying the greedy strategy to the remaining piece of length n-i.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer