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

IAL 2025 Jan D1 Q1

A Level / Edexcel / D1

IAL 2025 Jan Paper · Question 1

题目

Problem

The following list of eleven numbers is to be packed into bins of size 55

2619311014303318328526 \quad 19 \quad 31 \quad 10 \quad 14 \quad 30 \quad 33 \quad 18 \quad 3 \quad 28 \quad 5

(a) Use the first-fit bin packing algorithm to pack the numbers into bins of size 55.

(3)

(b) Use quick sort to sort the list into descending order, showing the result after each pass. You must clearly identify the pivots used.

(4)

(c) Apply the first-fit decreasing bin packing algorithm to pack the numbers into bins of size 55.

(2)
题目中文翻译

以下十一个数字列表需要装入容量为 55 的箱子中

2619311014303318328526 \quad 19 \quad 31 \quad 10 \quad 14 \quad 30 \quad 33 \quad 18 \quad 3 \quad 28 \quad 5

(a) 使用首次适应装箱算法将数字装入容量为 55 的箱子。

(b) 使用快速排序将列表按降序排列,显示每轮后的结果。必须清楚标明所使用的基准元素。

(c) 应用首次适应递减装箱算法将数字装入容量为 55 的箱子。

解答

(a)

解法一

思路

展开

保持题目给出的顺序,逐个处理数字。每个数字都从第一个箱子开始检查,放入第一个剩余容量足够的箱子;只有所有已有箱子都放不下时,才启用新箱子。

答题过程

展开

Applying first-fit in the given order gives

NumberFirst available binLoad after placement
26126
19145
31231
10155
14245
30330
33433
18348
3248
28528
5253

Thus the packing is

BinNumbersTotal
126, 19, 1055
231, 14, 3, 553
330, 1848
43333
52828

(b)

解法一

思路

展开

采用官方评分方案中的 middle-right 规则:偶数长度子列选择中间两个元素中的右侧元素作基准。每轮将大于基准的元素放在左侧、小于基准的元素放在右侧,以得到降序排列,并对所有尚未排好的子列同时重复。

答题过程

展开

Using middle-right pivots, begin with pivot 30.

Pass 1:

31  33  |30|  26  19  10  14  18  3  28  5

The next pivots are 33 and 18.

Pass 2:

33  31  |30|  26  19  28  18  10  14  3  5

The next nontrivial pivots are 19 and 3; the one-element partition 31 is already sorted.

Pass 3:

33  31  30  26  28  19  18  10  14  5  3

The next pivots are 28 and 14.

Pass 4:

33  31  30  28  26  19  18  14  10  5  3

The remaining nontrivial pivot is 5; the one-element partition 26 is already sorted.

Pass 5:

33  31  30  28  26  19  18  14  10  5  3

The final one-element pivot is 10. Hence the list in descending order is

33,31,30,28,26,19,18,14,10,5,3.\boxed{33,31,30,28,26,19,18,14,10,5,3}.

解法二

思路

展开

也可采用官方认可的 middle-left 规则:偶数长度子列选择中间左项。只要后续子列持续使用同一规则,也会得到相同的降序结果。

答题过程

展开

Using middle-left pivots, begin with pivot 30.

Pass 1:

31  33  |30|  26  19  10  14  18  3  28  5

The next pivots are 31 and 14.

Pass 2:

33  31  30  26  19  18  28  14  10  3  5

The next nontrivial pivots are 19 and 3; the one-element partition 33 is already sorted.

Pass 3:

33  31  30  26  28  19  18  14  10  5  3

The next nontrivial pivots are 26 and 10; the one-element partition 18 is already sorted.

Pass 4:

33  31  30  28  26  19  18  14  10  5  3

The remaining one-element pivots are 28 and 5. Therefore, the list in descending order is

33,31,30,28,26,19,18,14,10,5,3.\boxed{33,31,30,28,26,19,18,14,10,5,3}.

(c)

解法一

思路

展开

先使用 (b) 的降序列表,再依次应用首次适应规则。每个数字仍要从第一个箱子开始检查,不能为了得到更紧凑的组合而任意调整放置顺序。

答题过程

展开

Using the descending order

33,31,30,28,26,19,18,14,10,5,3,33,31,30,28,26,19,18,14,10,5,3,

first-fit decreasing gives

BinNumbersTotal
133, 19, 355
231, 18, 554
330, 14, 1054
428, 2654