📚 Algorithms for IGCSE WJEC Mathematics | IGCSE WJEC 数学:算法 考点精讲
Algorithms form the logical backbone of computer science and modern mathematics. In the IGCSE WJEC Mathematics specification, understanding algorithms helps you follow precise step-by-step procedures to solve problems, analyse sequences, and make decisions. This article unpacks every key concept you need, from flowcharts and pseudocode to sorting and searching techniques.
算法是计算机科学和现代数学的逻辑基础。在 IGCSE WJEC 数学考纲中,理解算法有助于你遵循精确的逐步程序来解决问题、分析序列并做出决策。本文剖析你所需的每个关键概念,涵盖流程图、伪代码以及排序与搜索技术。
1. What is an Algorithm? | 什么是算法?
An algorithm is a finite sequence of well-defined instructions designed to perform a task or solve a problem. It must be clear, unambiguous, and terminate after a limited number of steps. In WJEC Mathematics, algorithms often involve arithmetic operations, comparisons, loops, and conditional statements.
算法是一个有限且定义明确的指令序列,旨在执行某项任务或解决某个问题。它必须清晰、无歧义,并且在有限步数后终止。在 WJEC 数学中,算法通常涉及算术运算、比较、循环和条件语句。
You apply algorithms every day without realising it — from adding two numbers column by column to following a recipe. In exams, you may be asked to trace an algorithm, complete missing steps, or design your own to solve a given mathematical puzzle.
你每天都在不知不觉中应用算法——从逐列相加两个数字到按照食谱操作。考试中可能要求你追踪算法、补全缺失步骤,或自行设计算法来解决给定的数学谜题。
2. Representing Algorithms with Flowcharts | 用流程图表示算法
Flowcharts give a visual representation of an algorithm using standard symbols connected by arrows. They show the direction of logic and make it easier to check whether every possible path is accounted for. WJEC exam questions frequently provide a flowchart and ask you to interpret or complete it.
流程图通过标准符号和箭头直观地表示算法。它们显示逻辑流向,便于检查是否涵盖了每条可能路径。WJEC 试题经常提供流程图,要求你解读或将其补充完整。
When tracing a flowchart, you act as the computer: keep track of variable values in a trace table, follow arrows strictly, and update data at each step. A typical flowchart includes a start/end oval, rectangular process boxes, diamond decision boxes, and arrows that designate the flow.
追踪流程图时,你应模拟计算机运行:在追踪表中记录变量数值,严格遵循箭头方向,并在每一步更新数据。典型流程图包含开始/结束的椭圆形框、矩形处理框、菱形判断框以及指示流向的箭头。
3. Flowchart Symbols | 流程图符号
The WJEC exam expects you to recognise and use these symbols accurately: the oval (terminator) marks the start or end; the rectangle (process) holds an instruction like ‘x ← x + 1’; the diamond (decision) contains a yes/no question such as ‘is n > 0?’; the parallelogram (input/output) shows where data is read or displayed; arrows indicate the direction of flow.
WJEC 考试要求你准确识别并使用这些符号:椭圆形(终止符)标记开始或结束;矩形(处理框)容纳如 ‘x ← x + 1’ 的指令;菱形(判断框)包含是/否问题,例如 ‘n > 0?’;平行四边形(输入/输出)显示数据读取或显示的位置;箭头指示流程方向。
Remember that each decision diamond must have two labelled outgoing arrows — one for ‘Yes’ and one for ‘No’. Missing one of these labels is a common mistake that loses marks. Also, all steps must connect back to the main flow; no dead ends apart from the terminator.
请记住,每个判断框必须有两条标记清晰的输出箭头——一条 ‘Yes’,一条 ‘No’。遗漏任一标签都是常见的失分错误。此外,除终止符外,所有步骤必须回到主流程,不能出现死胡同。
4. Pseudocode and Structured English | 伪代码与结构化英语
Pseudocode is a plain-language description of an algorithm that uses conventions similar to programming code but remains readable by humans. In WJEC papers, pseudocode uses keywords like INPUT, OUTPUT, IF … THEN … ELSE, FOR … TO … NEXT, WHILE … DO … ENDWHILE, and the assignment arrow ←.
伪代码是使用类似编程代码的惯例,却仍然易于人阅读的算法描述。WJEC 试卷中,伪代码使用 INPUT、OUTPUT、IF … THEN … ELSE、FOR … TO … NEXT、WHILE … DO … ENDWHILE 和赋值箭头 ← 等关键词。
A powerful approach is to write a trace table beside a pseudocode listing. By stepping through each line and recording variable values, you can predict the final output without running the code. This skill is directly tested in questions where you must complete a trace table or determine what will be printed.
一个有效的方法是在伪代码清单旁编写追踪表。逐步执行每一行并记录变量值,就能在无需运行代码的情况下预测最终输出。这一技能在要求你补全追踪表或判断打印内容的题目中直接考查。
5. Sorting Algorithm: Bubble Sort | 排序算法:冒泡排序
Bubble sort repeatedly steps through a list, compares adjacent items, and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed. While it is rarely the most efficient method, bubble sort is straightforward to trace and appears frequently in IGCSE questions.
冒泡排序反复遍历列表,比较相邻项,若顺序错误则交换它们。该遍历过程重复执行,直到没有交换发生为止。尽管它很少是最有效的方法,但冒泡排序容易追踪,在 IGCSE 考题中频频出现。
For a list of n numbers, bubble sort requires at most n−1 passes. After the first pass, the largest element ‘bubbles’ to the end. You can optimise the algorithm by reducing the range of each pass because the last i elements are already sorted after i passes. Practise showing each pass in exam-style tables.
对于包含 n 个数字的列表,冒泡排序最多需要 n−1 次遍历。第一遍遍历后,最大元素 ‘冒泡’ 到末尾。你可以通过缩小每趟遍历的范围来优化算法,因为 i 遍之后末尾 i 个元素已排好序。请练习用考试风格的表格展示每一遍遍历。
6. Search Algorithms: Linear Search and Binary Search | 搜索算法:线性搜索与二分搜索
Linear search checks each element of a list in turn until the target is found or the list ends. It works on unsorted data and is simple to understand, but its average number of comparisons grows in proportion to the list length. WJEC questions often ask you to count comparisons or complete a trace of a linear search.
线性搜索依次检查列表中的每个元素,直到找到目标或列表结束。它适用于未排序的数据且易于理解,但其平均比较次数与列表长度成正比。WJEC 考题常要求你统计比较次数或完成线性搜索的追踪。
Binary search works on a sorted list. It finds the middle element, compares it to the target, and discards the half that cannot contain the value. This halving continues until the item is found or the sublist is empty. For a list of size n, binary search needs at most ⌈log₂(n+1)⌉ comparisons, which is far more efficient on large data sets.
二分搜索适用于已排序的列表。它找到中间元素,与目标比较,并丢弃不可能包含该值的一半。这种折半操作持续到找到该项或子列表为空。对于大小为 n 的列表,二分搜索最多需要 ⌈log₂(n+1)⌉ 次比较,在大数据集上效率高得多。
7. Algorithm Efficiency and Comparison | 算法效率与比较
Efficiency matters because the number of steps determines how long a task takes. In WJEC Mathematics, you are not expected to perform formal Big O analysis, but you should be able to explain why one algorithm is faster than another for certain inputs. Focus on the number of comparisons or swaps as a measure of work.
效率之所以重要,是因为步骤数量决定了任务耗时。在 WJEC 数学中,并不要求你进行正式的大 O 分析,但你应能解释为何对于某些输入,一种算法比另一种更快。重点是将比较或交换次数作为工作量的度量。
Bubble sort makes about n²/2 comparisons in the worst case, while a linear search examines up to n items. Binary search, with its logarithmic growth, is the clear winner for sorted data. Being able to compare these counts will strengthen your evaluation answers.
冒泡排序在最坏情况下大约进行 n²/2 次比较,而线性搜索最多检查 n 项。具有对数增长的二分搜索在已排序数据上明显胜出。能够比较这些计数将增强你的评估型答案。
8. Common Mistakes and Exam Tips | 常见错误与考试技巧
One frequent mistake is misreading the assignment arrow ← as ‘equals to’. It means ‘becomes’, so ‘x ← x + 2’ updates x by adding 2. Another is skipping the initialisation of variables; always check whether a variable starts at 0, 1, or is input by the user at the start of the algorithm.
一个常见错误是将赋值箭头 ← 误读为 ‘等于’。它表示 ‘变为’,因此 ‘x ← x + 2’ 是将 x 的值增加 2。另一个错误是跳过变量初始化;务必检查变量是从 0、1 开始,还是在算法开始时由用户输入。
In flowcharts, ensure your decision diamonds contain a true/false or yes/no question, and label both outgoing arrows. In trace tables, write the new value of a variable only when it changes; repeating the old value in the same column is acceptable but can be messy. Finally, leave a few minutes to re-trace critical steps to catch arithmetic errors.
在流程图中,确保判断框包含真/假或是否问题,并标注两条输出箭头。在追踪表中,仅当变量改变时才写入新值;在同一列中重复原值虽可接受,但可能显得凌乱。最后,留出几分钟重新追踪关键步骤以捕捉算术错误。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导