Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have to cut a log into several pieces. To do so, you bring it to a company that charges money according to the length

You have to cut a log into several pieces. To do so, you bring it to a company that charges money according to the length of the log being cut. Their cutting method means that only one cut can be made at a time. For example, suppose that a log of length 10 meters has to be cut at positions 2, 4, and 7 from one end. There are several ways to do this. One way is to first cut at 2, then 4, and then at 7. This gives a price of 10 + 8 + 6 = 24 because the first piece was 10 meters in length, the second was 8 meters, and the third was 6 meters in length. Another way is to cut at 4, then at 2, then at 7. This would give a total price of 10 + 4 + 6 = 20, which is a cheaper price.

One could consider several different greedy algorithms for this log cutting problem.

(a) Provide a counterexample to show that a greedy algorithm that always makes the median cut first is not correct. (If n cuts have to be made, the median cut is the n/2th cut, where ever it is located.

(b) Provide a counterexample to show that a greedy algorithm that always makes the cut closest to the center of the log first is not correct.

(c) Propose another simple, greedy way of choosing the first cut, and show that that does not work either.

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_2

Step: 3

blur-text-image_3

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

GAO Yellow Book Government Auditing Standar

Authors: Comptroller General United States Government

2011edition

1479245577, 978-1479245574

More Books

Students also viewed these Accounting questions