Skip to content
CalcGospel 國際數學圖譜
返回

D1 2021 Oct Q7

A Level / Edexcel / D1

IAL 2021 Oct Paper · Question 7

题目

Problem

The numbers listed below are to be packed into bins of size nn, where nn is a positive integer.

1420231715221925132832\begin{gathered} 14 \quad 20 \quad 23 \quad 17\\[4mm] 15 \quad 22 \quad 19 \quad 25\\[4mm] 13 \quad 28 \quad 32 \end{gathered}

A lower bound for the number of bins required is 4.

(a) Determine the range of possible values of nn. You must make your method clear.

(3)

(b) Carry out a quick sort to produce a list of the numbers in descending order. You should show the result of each pass and identify your pivots clearly.

(4)

When the first-fit bin packing algorithm is applied to the original list of numbers, the following allocation is achieved.

Bin 1: 1420231514 \quad 20 \quad 23 \quad 15

Bin 2: 1722191317 \quad 22 \quad 19 \quad 13

Bin 3: 252825 \quad 28

Bin 4: 3232

When the first-fit decreasing bin packing algorithm is applied to the sorted list of numbers, the following allocation is achieved.

Bin 1: 322832 \quad 28

Bin 2: 25232225 \quad 23 \quad 22

Bin 3: 2019171520 \quad 19 \quad 17 \quad 15

Bin 4: 141314 \quad 13

(c) Determine the value of nn. You must explain your reasoning fully.

(3)
题目中文翻译

下面列出的数字要装入大小为 nn 的箱子中,其中 nn 是正整数。

1420231715221925132832\begin{gathered} 14 \quad 20 \quad 23 \quad 17\\[4mm] 15 \quad 22 \quad 19 \quad 25\\[4mm] 13 \quad 28 \quad 32 \end{gathered}

所需箱子数量的下界为 4。

(a) 确定 nn 的可能取值范围。必须清楚说明方法。

(3)

(b) 执行快速排序以产生降序的数字列表。应显示每次传递的结果并清楚地标出枢轴。

(4)

当对原始数字列表应用首次适应装箱算法时,获得以下分配。

箱 1:1420231514 \quad 20 \quad 23 \quad 15

箱 2:1722191317 \quad 22 \quad 19 \quad 13

箱 3:252825 \quad 28

箱 4:3232

当对排序后的数字列表应用首次适应递减装箱算法时,获得以下分配。

箱 1:322832 \quad 28

箱 2:25232225 \quad 23 \quad 22

箱 3:2019171520 \quad 19 \quad 17 \quad 15

箱 4:141314 \quad 13

(c) 确定 nn 的值。必须完全解释推理过程。

(3)

解答

(a)

解法一

思路

展开

所有数的总和为 228。箱数下界为 4,表示总重量除以箱子容量后大于 3 且不超过 4。利用 n>0n>0 解这个双重不等式,再结合 nn 是正整数写出范围。

答题过程

展开

The total of the numbers is 228228. Since the lower bound is 44,

3<228n≤4.3<\frac{228}{n}\leq4.

As n>0n>0,

 3n<228 and228≤4n.\begin{align*} &\,3n<228\\[4mm] &\,\text{and}\quad228\leq4n. \end{align*}

Therefore

n<76andn≥57.n<76 \quad\text{and}\quad n\geq57.

Since nn is an integer,

57≤n≤75.\boxed{57\leq n\leq75}.

(b)

解法一

思路

展开

采用 middle-right 规则选枢轴,并按降序排列:大于枢轴的数放在左侧,小于枢轴的数放在右侧。对每个尚未排好的子列表继续使用相同规则;竖线表示枢轴已经固定。

答题过程

展开

Using middle-right pivots, the initial pivot is 2222.

 23,25,28,32∣22∣ 14,20,17,15,19,13\begin{align*} &\,23,25,28,32\mid22\mid\\[4mm] &\,\hspace{2pt}14,20,17,15,19,13 \end{align*}

Using pivots 2828 and 1515 gives

 32∣28∣23,25∣22∣ 20,17,19∣15∣14,13.\begin{align*} &\,32\mid28\mid23,25\mid22\mid\\[4mm] &\,\hspace{2pt}20,17,19\mid15\mid14,13. \end{align*}

Using pivots 2525, 1717 and 1313 gives

 32∣28∣25∣23∣22∣ 20,19∣17∣15∣14∣13.\begin{align*} &\,32\mid28\mid25\mid23\mid22\mid\\[4mm] &\,\hspace{2pt}20,19\mid17\mid15\mid14\mid13. \end{align*}

Finally, using pivot 1919 gives

32,28,25,23,22,20,19,17,15,14,13.\boxed{\begin{gathered} 32,28,25,23,22,\\[4mm] 20,19,17,15,14,13 \end{gathered}}.

解法二

思路

展开

也可以一致地采用 middle-left 规则。第一次仍以 22 为枢轴;之后各子列表的枢轴选择会不同,但最终降序列表不变。

答题过程

展开

Using middle-left pivots, the initial pivot is 2222.

 23,25,28,32∣22∣ 14,20,17,15,19,13\begin{align*} &\,23,25,28,32\mid22\mid\\[4mm] &\,\hspace{2pt}14,20,17,15,19,13 \end{align*}

Using pivots 2525 and 1717 gives

 28,32∣25∣23∣22∣ 20,19∣17∣14,15,13.\begin{align*} &\,28,32\mid25\mid23\mid22\mid\\[4mm] &\,\hspace{2pt}20,19\mid17\mid14,15,13. \end{align*}

Using pivots 2828, 2020 and 1515 gives

 32∣28∣25∣23∣22∣ 20∣19∣17∣15∣14,13.\begin{align*} &\,32\mid28\mid25\mid23\mid22\mid\\[4mm] &\,\hspace{2pt}20\mid19\mid17\mid15\mid14,13. \end{align*}

Finally, using pivot 1414 gives

32,28,25,23,22,20,19,17,15,14,13.\boxed{\begin{gathered} 32,28,25,23,22,\\[4mm] 20,19,17,15,14,13 \end{gathered}}.

(c)

解法一

思路

展开

先用 first-fit 的 Bin 1 得到容量只能是 72 或 73:其中已有数的总和为 72,而先前尝试放入的 17 会令总和达到 74,所以它放不下。再看 first-fit decreasing 的 Bin 1,若容量是 73,最后的 13 应能与 32、28 同箱;实际没有放入,因此容量小于 73。两项条件合起来唯一可能是 72。

答题过程

展开

In the first-fit packing, Bin 1 contains

14+20+23+15=72,14+20+23+15=72,

so n≥72n\geq72. The value 1717 was considered before 1515 but did not fit in Bin 1, and

14+20+23+17=74.14+20+23+17=74.

Hence n<74n<74. Since nn is an integer,

n∈{72,73}.n\in\{72,73\}.

In the first-fit decreasing packing, Bin 1 contains 3232 and 2828, but the later value 1313 does not fit there. Therefore

32+28+13=73>n,32+28+13=73>n,

so n<73n<73. Combining the conditions,

n=72.\boxed{n=72}.