📚 A-Level Edexcel Mathematics: Algorithms – Essential Revision | 爱德思A-Level数学:算法考点精讲
Algorithms form the foundation of Edexcel Decision Mathematics 1. They appear in sorting, searching, graph theory and critical path analysis. Mastering the step‑by‑step procedures, notation and common pitfalls is essential for achieving top marks in the exam. This revision guide covers every key algorithm you will encounter, with clear English explanations followed by equivalent Chinese summaries, worked examples and examination tips.
算法是爱德思决策数学1的基础,贯穿排序、搜索、图论和关键路径分析等内容。掌握每一步的操作流程、规范记法以及常见失分点,是取得高分的必备条件。本精讲用英文和中文配对讲解每个核心算法,配有示例和应试技巧,帮助你系统攻克算法考点。
1. Understanding Algorithms and Flowcharts | 理解算法与流程图
An algorithm is a finite sequence of well‑defined, unambiguous instructions designed to solve a specific problem. In D1, algorithms are often described using pseudocode or flowcharts. A flowchart uses standard symbols: ovals for start/stop, rectangles for processes, diamonds for decisions, and parallelograms for input/output. Flow lines must be marked with arrows to show direction. Exam questions may ask you to interpret a given flowchart, complete a trace table, or identify the purpose of the algorithm.
算法是解决特定问题的一组有限、明确且无歧义的指令。在D1中,算法常通过伪代码或流程图描述。流程图使用标准符号:椭圆形表示开始/结束,矩形表示处理过程,菱形表示判断,平行四边形表示输入/输出。流向线必须用箭头标明方向。考试可能会要求你解释给定的流程图、补全跟踪表或识别算法的功能。
- Start and end are always oval. | 开始和结束总是用椭圆形。
- Process boxes contain instructions like ‘count ← count + 1’. | 处理框内写操作指令,如 ‘count ← count + 1’。
- A diamond decision box has two exit branches (Yes/No). | 菱形判断框有两条出口分支(是/否)。
- Arrows must show the order of execution. | 箭头必须显示执行顺序。
Always annotate the flowchart if a question asks ‘explain what happens’. | 如果题目要求“解释发生的过程”,一定要在流程图上加标注。
2. Bubble Sort Algorithm | 冒泡排序算法
Bubble sort arranges a list into ascending order by repeatedly comparing adjacent pairs and swapping them if they are in the wrong order. After each full pass, the largest remaining element ‘bubbles’ to its correct position at the end of the list. You are expected to record the state of the list after each swap or after each complete pass, depending on the question. Usually, for an n‑item list, at most n−1 passes are needed.
冒泡排序通过反复比较相邻元素并交换位置,将列表排成升序。每完成一趟遍历,当前最大的元素会“冒泡”到列表末尾的正确位置。根据题意,你需要记录每次交换后或每趟遍历结束后的列表状态。通常有n个元素的列表最多需要n−1趟。
Worked example: Sort [5, 2, 7, 4] using bubble sort. Show the list after each pass.
示例:用冒泡排序对 [5, 2, 7, 4] 排序,显示每趟后的列表。
| Pass 1 | Compare 5,2 → swap → [2,5,7,4]; compare 5,7 → no swap; compare 7,4 → swap → [2,5,4,7] |
| Pass 2 | [2,5,4,7] → compare 2,5 no swap; compare 5,4 swap → [2,4,5,7] |
| Pass 3 | [2,4,5,7] → no swaps needed, algorithm can stop early. |
Common mistake: continuing passes after the list is already sorted. You can stop if a pass makes no swaps. | 常见错误:列表已排好序后还在继续遍历。如果某趟没有发生任何交换,算法可以提前终止。
3. Quick Sort Algorithm | 快速排序算法
Quick sort selects a pivot – in Edexcel D1 the pivot is the middle item (if the list has an even number of items, take the item to the right of centre, i.e. at index n/2 + 1). Items smaller than the pivot are placed into a left sublist, items larger into a right sublist, while the pivot stays in its final position. The process is then applied recursively to each sublist. You must show the sublists and the position of the pivot at each stage.
快速排序选择一个枢轴——在爱德思D1中,枢轴总是选取列表的中间项(若列表有偶数个元素,则取中心偏右的那一项,即索引 n/2 + 1 处)。小于枢轴的项放入左子列表,大于枢轴的项放入右子列表,枢轴则留在最终位置。然后对每个子列表递归重复该过程。你必须展示每一步的子列表和枢轴位置。
To gain full marks, write sublists as sequences separated by commas and clearly indicate the pivot in its fixed spot, e.g. [2, 4] 5 [7, 9]. | 为得满分,把子列表写成逗号分隔的序列,并清楚标出枢轴的固定位置,如 [2, 4] 5 [7, 9]。
Quick example: Sort [8,3,6,1,9,2]
Pivot is the 4th item? With 6 items, n/2+1 = 6/2+1 = 4, so pivot = 1. Left sublist = empty, right sublist = [8,3,6,9,2]. Final order for pivot 1. Then pivot of right sublist: 5 items, pivot = 3rd item = 6. Continue.
简例:排序 [8,3,6,1,9,2]。6个元素,枢轴为第4项 = 1。左子列表为空,右子列表 [8,3,6,9,2],1就位。对右子列表取枢轴:5个元素,第3项 = 6。继续递归。
4. Binary Search Algorithm | 二分查找算法
Binary search works on an already sorted list. It repeatedly divides the search interval in half. Set low = 1, high = n. Compute mid = floor((low + high) / 2). If the target equals the value at mid, stop. If the target is less, set high = mid − 1; if greater, set low = mid + 1. The algorithm continues until the item is found or low > high (not found). You must show a search table with columns for low, high, mid and the comparison result.
二分查找适用于已排好序的列表。它反复将查找区间折半。设 low = 1, high = n,计算 mid = floor((low + high) / 2)。如果目标等于 mid 位置的值,则查找成功;如果目标小于该值,则 high = mid − 1;如果大于,则 low = mid + 1。重复执行,直到找到目标或 low > high(未找到)。你必须用表格展示查找过程,列出 low, high, mid 及比较结果。
Exam tip: when the list length is even and the middle point falls exactly between two items, floor() takes the lower index. This is consistently used in Edexcel. | 应试提示:当列表长度为偶数,中点恰好落在两个元素之间时,floor() 取下方的索引。爱德思一贯采用此规则。
5. Kruskal’s Algorithm for Minimum Spanning Tree | 克鲁斯卡尔最小生成树算法
Kruskal’s algorithm builds a minimum spanning tree (MST) by selecting edges in increasing order of weight, adding an edge only if it does not form a cycle. Steps: (1) List all edges with their weights. (2) Sort them by weight ascending. (3) Consider each edge in order; include it if it connects two different components (i.e. does not create a cycle). (4) Stop when exactly n−1 edges have been selected, where n is the number of vertices. You must list the edges in the order they are added and state the total weight.
克鲁斯卡尔算法通过按权重递增的顺序选取边来构建最小生成树,仅在不形成环时加入该边。步骤:(1) 列出所有边及其权重。(2) 按权重升序排序。(3) 依次考虑每条边;如果它连接两个不同的连通分量(即不形成环),则将其加入树中。(4) 当恰好选出了 n−1 条边时停止(n 为顶点数)。你必须按加入顺序列出边并计算总权重。
Use a table or list to show the decision for each edge. Common pitfall: forgetting to check for cycles when edges have the same weight. If two edges have equal weight, you may choose either, but be consistent. | 用表格或列表展示每条边是否被采纳。常见陷阱:当多条边权重相同时忘记检查环。如果权重相同,你可以任选顺序,但必须保持方法一致。
6. Prim’s Algorithm for Minimum Spanning Tree | 普里姆最小生成树算法
Prim’s algorithm builds an MST by growing a tree from an arbitrary start vertex. At each step, select the edge of minimum weight that connects a vertex already in the tree to a vertex not yet in the tree. Add this edge and the new vertex to the tree. Repeat until all vertices are included. The algorithm can be applied to a graph (draw the tree stepwise) or to a distance matrix (cross out used columns, underline chosen values).
普里姆算法从任意起始顶点出发,逐步扩展生成树。每一步选择连接树内顶点与树外顶点且权重最小的边,将该边和新顶点加入树中。重复直至所有顶点都被包含。该算法可用于图(逐步画出树)或距离矩阵(划去已用列,在选定值下划下划线)。
On a matrix: start from a chosen row (vertex). Cross out that column. Find the smallest entry in the remaining columns of the current tree’s rows; underline it. Add the corresponding vertex to the tree, crossing out its column. Continue until all columns are crossed out. | 在矩阵上:从选定行(顶点)开始,划去其列。在当前树所有行的剩余列中找出最小的数字,划线标记;将该数字对应的顶点加入树,并划去其列。重复直至所有列被划去。
Edexcel often asks for Prims on a matrix. Always record the order of selected edges and the total weight. | 爱德思常考在矩阵上执行普里姆算法。务必记录选边的顺序和总权重。
7. Dijkstra’s Shortest Path Algorithm | 迪杰斯特拉最短路径算法
Dijkstra’s algorithm finds the shortest path from a source vertex to all other vertices in a weighted graph with non‑negative weights. It uses two types of labels: permanent (boxed) and temporary (in brackets). Steps: (1) Give the source vertex permanent label 0. (2) For each vertex, v, with a permanent label, update the temporary label of each adjacent vertex u: if (label at v) + (weight of edge vu) < current temporary label at u, replace it. (3) Choose the smallest temporary label, make it permanent. (4) Repeat until all vertices have permanent labels. Record the order of permanence and the working values.
迪杰斯特拉算法用于在权重非负的加权图中找到从源顶点到所有其他顶点的最短路径。它使用两种标签:永久标签(方框)和临时标签(圆括号)。步骤:(1) 给源顶点永久标签0。(2) 对于每个有永久标签的顶点v,更新其每个邻接顶点u的临时标签:如果 (v的标签) + (边vu的权重) < u当前的临时标签,则替换之。(3) 选取临时标签中最小的,将其设为永久。(4) 重复直至所有顶点都有永久标签。记录永久化顺序及各步计算值。
Always show the network with boxes and brackets at each vertex. After the algorithm, you can read off the shortest path and its length. To find the route, trace back from the destination using the working values and the edge weights. | 始终在图上用方框和圆括号标出每个顶点的标签。算法结束后,你可以直接读出的最短路径及其长度。若要找出实际路径,可从终点根据工作数值和边权重反向追溯。
8. Forward and Backward Pass in Critical Path Analysis | 关键路径分析中的前向与后向扫描
Critical path analysis (CPA) uses an activity‑on‑node network where each node represents an activity with a duration. The forward pass computes the earliest start time (EST) for each activity: EST = max(EST of all preceding activities + their duration). The project duration is the EST of the end activity. The backward pass calculates the latest start time (LST): LST = min(LST of all following activities) – duration. Total float = LST – EST. Activities with zero total float are critical and form the critical path.
关键路径分析使用活动在节点(AON)网络,每个节点代表一个活动并带有持续时间。前向扫描计算各活动的最早开始时间(EST):EST = max(所有紧前活动的EST + 持续时间)。项目总工期为终点活动的EST。后向扫描计算最晚开始时间(LST):LST = min(所有后续活动的LST) – 持续时间。总时差 = LST – EST。总时差为零的活动即为关键活动,它们构成关键路径。
Label each node with its duration, EST and LST in a standard format, e.g. a box split into cells. Edexcel expects you to perform both passes and state the critical path clearly, e.g. A – C – F – H. | 用标准格式给每个节点标注持续时间、EST和LST,例如用分格方框表示。爱德思要求你完成两个扫描并明确写出关键路径,如 A – C – F – H。
9. Scheduling Diagrams and List Processing | 调度图与列表处理算法
Once activity start times and dependencies are known, scheduling allocates activities to workers over time, respecting resource constraints. The list processing algorithm uses a priority list (often alphabetical or derived from critical path order) and assigns the next available activity to the first free worker. A Gantt chart (cascade diagram) is then drawn to show which worker performs each activity in each time unit. You may be asked to schedule with a given number of workers and determine the minimum completion time.
当已知活动开始时间和依赖关系后,调度就是在资源约束下将活动分配给工人。列表处理算法依据一个优先列表(通常按字母顺序或由关键路径顺序导出),将下一个可开始的活动分配给最早空闲的工人。然后画出甘特图(瀑布图)来展示每个时间单位由哪位工人执行哪项活动。考试可能要求你用给定数量的工人进行调度,并确定最短完工时间。
While drawing the Gantt chart, ensure that precedence constraints are never violated. If the priority list is not specified, you can choose any valid order, but the critical path must be respected. Mark idle times clearly. | 画甘特图时,务必确保不违反先后依赖关系。如果未指定优先列表,你可以任选一种有效顺序,但必须尊重关键路径。要清楚标出工人的空闲时间。
Examiners often ask whether adding an extra worker reduces the project length – the answer depends on the critical activities and available parallelism. | 考官常问增加工人是否可以缩短工期——答案取决于关键活动以及活动的可并行性。
Published by TutorHao | Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导