题目
The numbers in the list shown above are the weights, in kilograms, of ten boxes. The boxes are to be transported in containers that will each hold a maximum weight of 40 kilograms.
(a) Calculate a lower bound for the number of containers that will be needed to transport the boxes. You must show your working.
(b) Use the first-fit bin packing algorithm to allocate the boxes to the containers.
(c) Using the list provided, carry out a quick sort to produce a list of the weights in ascending order. You must make your pivots clear.
(d) Use the binary search algorithm to try to locate the weight of 9 in the sorted list. Clearly indicate how you choose your pivots and which part of the list is being rejected at each stage.
题目中文翻译
上面列表中的数字是十个箱子的重量(单位:千克)。箱子将用容器运输,每个容器最多可容纳 40 千克。
(a) 计算运输箱子所需容器数量的下界。必须展示计算过程。
(b) 使用首次适应装箱算法将箱子分配给容器。
(c) 使用提供的列表,执行快速排序以产生升序的重量列表。必须清楚标出枢轴。
(d) 使用二分搜索算法尝试在排序列表中定位重量 9。清楚说明如何选择枢轴以及每个阶段拒绝列表的哪一部分。