(10 pts) You are given a set of boxes to be packed into bins.
All the boxes have the same width and depth (the same as the width and depth
of the bins), but they have different heights. The heights are given
in a list H=(h1,...,hn). The goal is to pack the
boxes in bins using as few bins as possible. Consider the following
greedy algorithm for this problem:
FirstFit (H):
Sort H from largest to smallest;
for i = 1 to n do
Find the first bin that has enough room for H[i];
Place box i in this bin;
end FirstFit.
Does this algorithm always use the minimum number of bins? Either prove
the algorithm produces an optimal solution or give an example to show that
it does not.