This preview shows pages 1–2. Sign up to view the full content.
HW8 SOLUTION
1.
Chapter 11
Problem 1:
This problem is known as Bin Packing, and has a long history of
study. We’ll only scratch the surface here, of course.
(a) An example would be to have
K
= 10, and have items of weights
w
1
= 6
,w
2
=
6
,w
3
= 4
,w
4
= 4. Then, we could pack items 1 and 1 on the truck, and 2 and 4 on
another, for a total of two trucks. Instead, the greedy algorithm packs item 1 on
a truck by itself, then puts 2 and 3 on another truck, and ﬁnally puts item 4 on a
truck by itself. Thus, it uses 3 trucks.
(b) Perhaps the easiest way to prove this is as follows. We let
l
j
denote the load of
the
j

th
truck, i.e., the total weight of all items that were put on truck
j
. Then,
we always have that
l
j
+
l
j
+1
> K
. For otherwise, the ﬁrst item that ended up on
truck
j
+ 1 would have been put on truck
j
by the algorithm, as it would still have
ﬁt there.
Let
m
be the number of trucks used by the algorithm and
L
=
∑
j
l
j
be the total
load. We can now rewrite
L
=
∑
j
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '06
 Shamsian
 Algorithms

Click to edit the document details