Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose a ship arrives with n containers labeled 1,2,3,,n where container i has positive integer weight wi, for i=1 to n. In the shipyard is

image text in transcribed

Suppose a ship arrives with n containers labeled 1,2,3,,n where container i has positive integer weight wi, for i=1 to n. In the shipyard is a set of trucks, each capable of carrying K units of weight. You can put multiple containers in each truck subject to the weight restriction of K (that is, you cannot put more the K units of weight onto each truck). You may assume that wiK for each i=1 to n. The goal of the problem is to minimize the number of trucks that are needed in order to carry all the containers. It is known that this problem is NP-Hard (which you do not need to show). Consider the following greedy algorithm for this problem: The algorithm starts with an empty truck and begin placing containers 1,2,3, into it until we reach a container that doesn't fit on the current truck. At this point, a new truck is used to carry the current container, and the process repeats for the remaining containers. Answer the following question. (a) Give an example where the algorithm doesn't produce an optimal solution. (b) Show that if W=i=1nwi, then any feasible solution requires at least W/K trucks. (c) Show that if the algorithm uses at least 3 trucks, any two consecutive trucks that doesn't include the last truck used by the algorithm must have total weight >K

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

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions