← 返回资讯屏轩教育 · 行业资讯

Mastering Algorithms for GCSE WJEC Maths | GCSE WJEC 数学:算法考点精讲

2026-07-14 09:34 · 本文部分内容由AI辅助创作

📚 Mastering Algorithms for GCSE WJEC Maths | GCSE WJEC 数学:算法考点精讲

Algorithms are step-by-step procedures for solving problems. In GCSE WJEC Mathematics, understanding algorithms helps you think logically and approach computations systematically. This revision guide covers key concepts such as flowcharts, pseudocode, sorting, and searching, ensuring you are fully prepared for exam questions.

算法是解决问题的逐步程序。在 GCSE WJEC 数学中,理解算法有助于逻辑思维和系统化计算。本复习指南涵盖流程图、伪代码、排序和搜索等关键概念,确保你为考试做好充分准备。

1. What is an Algorithm? | 什么是算法?

An algorithm is a finite sequence of well-defined instructions to solve a problem or perform a task. In mathematics, algorithms are used for everything from simple calculations to complex data sorting. A good algorithm must be unambiguous, have a clear ending, and produce correct results for all valid inputs.

算法是解决一个问题或执行一项任务的明确定义的有限指令序列。在数学中,算法用于从简单计算到复杂数据排序的方方面面。一个好的算法必须明确无歧义、有清晰的结束,并对所有有效输入产生正确的结果。

Examples include the long division method, Euclid's algorithm for GCD, and even a recipe. In the exam, you may be asked to interpret or complete an algorithm represented as a flowchart or pseudocode.

例如长除法、求最大公约数的欧几里得算法,甚至一个食谱。考试中,可能会要求你解释或完成用流程图或伪代码表示的算法。


2. Flowchart Symbols | 流程图符号

Flowcharts use standard symbols to represent different parts of an algorithm. The main symbols are the oval, rectangle, diamond, parallelogram, and arrow. Each shape has a specific meaning and helps visualise the algorithm's logic.

流程图使用标准符号表示算法的不同部分。主要符号有椭圆、矩形、菱形、平行四边形和箭头。每种形状都有特定含义,有助于将算法的逻辑可视化。

The oval shape is used for the start and end points of an algorithm.

椭圆形状用于算法的开始和结束点。

The rectangle indicates a process step, such as a calculation or assignment.

矩形表示处理步骤,例如计算或赋值。

The diamond represents a decision, with a yes/no or true/false branch.

菱形表示决策,带有是/否或真/假的分支。

The parallelogram stands for input/output operations.

平行四边形代表输入/输出操作。

Arrows show the flow of control from one step to the next.

箭头显示控制从一个步骤到下一个步骤的流向。


3. Writing Pseudocode | 编写伪代码

Pseudocode is a simplified, informal way of describing an algorithm using structured English. It does not have strict syntax like a programming language, but it should be clear and logical. Common constructs include INPUT, OUTPUT, SET, IF...THEN...ELSE, FOR loops, and WHILE loops.

伪代码是一种使用结构化英语描述算法的简化、非正式方式。它没有像编程语言那样严格的语法,但应该清晰、有逻辑。常见结构包括 INPUT, OUTPUT, SET, IF...THEN...ELSE, FOR 循环和 WHILE 循环。

For example, a pseudocode to add two numbers:
INPUT a
INPUT b
sum ← a + b
OUTPUT sum

例如,两个数相加的伪代码步骤:输入 a,输入 b,将 a + b 赋给 sum,输出 sum。

Always use meaningful variable names and keep the structure indented to show nesting. In the exam, you are not marked on exact syntax but on logical correctness.

始终使用有意义的变量名,并保持缩进结构以显示嵌套。在考试中,不要求精确语法,而是要求逻辑正确。


4. Sequence | 顺序执行

Algorithms are executed in sequence, step by step, from top to bottom unless a control structure changes the flow. Correct sequencing is essential for the algorithm to produce the right outcome.

算法按照顺序从上到下逐步执行,除非控制结构改变了流程。正确的顺序对于算法产生正确结果至关重要。

mpute area = π × r², finally output area. Missing any step would make the algorithm wrong.

计算圆面积时,先输入半径,然后计算面积 = π × r²,最后输出面积。缺少任何一步都会导致算法错误。

When designing an algorithm, list the steps in a logical order and check if the output depends on any earlier unexecuted steps.

设计算法时,按逻辑顺序列出步骤,并检查输出是否依赖于任何尚未执行的较早步骤。


5. Selection: IF-ELSE | 选择结构:IF-ELSE

Selection allows the algorithm to make decisions and execute different paths based on conditions. The IF-ELSE structure tests a Boolean condition and chooses one of two branches.

选择结构允许算法做出决策,并根据条件执行不同路径。IF-ELSE 结构测试一个布尔条件,并选择两条分支之一。

For example, to check if a number is even: IF number MOD 2 = 0 THEN OUTPUT "Even" ELSE OUTPUT "Odd".

例如,检查一个数是否为偶数:如果 number MOD 2 = 0 则输出 "Even" 否则输出 "Odd"。

Multiple conditions can be nested: IF score ≥ 80 THEN grade ← "A" ELSE IF score ≥ 60 THEN grade ← "B" ELSE grade ← "C". Always ensure the condition uses appropriate comparison operators like =, ≠, <, >, ≤, ≥.

可以嵌套多个条件:IF score ≥ 80 THEN grade ← "A" ELSE IF score ≥ 60 THEN grade ← "B" ELSE grade ← "C"。始终确保条件使用适当的比较运算符,如 =、≠、<、>、≤、≥。


6. Iteration: FOR and WHILE Loops | 循环结构:FOR与WHILE

Iteration repeats a set of instructions. The FOR loop is used when the number of repetitions is known in advance, while the WHILE loop repeats as long as a condition is true.

循环重复执行一组指令。FOR 循环用于事先知道重复次数的情况,而 WHILE 循环在条件为真时重复。

FOR i from 1 to 5 OUTPUT i — this will print numbers 1 to 5.

FOR i 从 1 到 5 输出 i —— 这将打印数字 1 到 5。

WHILE total < 100 — continues adding numbers until total reaches or exceeds 100. Be careful to initialise the counter and update it inside the loop to avoid infinite loops.

WHILE total < 100 —— 继续加数直到 total 达到或超过 100。注意要初始化计数器并在循环内更新它,以避免无限循环。

FOR loops often use a counter variable that increments automatically, while WHILE loops require explicit update statements.

FOR 循环通常使用自动递增的计数器变量,而 WHILE 循环需要明确的更新语句。


广告 / Sponsored

7. Bubble Sort Algorithm | 冒泡排序算法

Bubble sort is a simple sorting algorithm that 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.

冒泡排序是一种简单的排序算法,它反复遍历列表,比较相邻项,如果顺序错误则交换它们。遍历列表的过程重复进行,直到不需要交换为止。

Algorithm steps in pseudocode:

伪代码算法步骤:

1) Compare first and second elements; if first > second, swap. 2) Move to next pair and repeat. 3) Continue until end of list. This completes one pass. 4) Repeat passes until no swaps occur in a pass.

1) 比较第一个和第二个元素;如果第一个大于第二个,则交换。2) 移至下一对并重复。3) 继续到列表末尾,完成一轮遍历。4) 重复遍历,直到某轮中没有交换发生。

After each pass, the largest unsorted element 'bubbles' to its correct position. The algorithm can be optimised by reducing the pass length each time.

每轮遍历后,最大的未排序元素会“冒泡”到它正确的位置。可以通过每次减少遍历长度来优化算法。


8. Binary Search Algorithm | 二分查找算法

Binary search finds the position of a target value within a sorted list. It repeatedly divides the search interval in half. If the target is less than the middle element, search the left half; if greater, search the right half.

二分查找在有序列表中查找目标值的位置。它反复将查找区间分成两半。如果目标值小于中间元素,则搜索左半部分;如果大于,则搜索右半部分。

Pseudocode steps:

伪代码步骤:

d. Else if target < list[mid], high = mid-1; else low = mid+1. 4) If not found, return -1.

1) 设 low = 0, high = 长度-1。2) 当 low ≤ high 时:mid = floor((low+high)/2)。3) 如果 list[mid] = target,返回 mid;否则如果 target < list[mid],high = mid-1;否则 low = mid+1。4) 如果没有找到,返回 -1。

Binary search is very efficient for large sorted lists because it halves the search space each time. Always ensure the list is sorted before applying this algorithm.

二分查找对于大的有序列表非常高效,因为每次都将搜索空间减半。在应用该算法之前,务必确保列表已排序。


9. Tracing and Debugging Algorithms | 跟踪算法与调试

Tracing an algorithm means manually following the steps with sample inputs to check for errors. A trace table is often used to record the values of variables at each step. This method helps you understand the algorithm's flow and spot mistakes.

跟踪算法意味着使用样本输入手动执行步骤以检查错误。通常使用跟踪表记录每一步的变量值。这种方法有助于你理解算法的流程并发现错误。

(using < instead of ≤), or logic errors in swaps. Always test boundary values such as empty lists, single element, or the target not present.

调试时,要查找常见错误,如无限循环(缺少增量或错误的 while 条件)、条件边界错误(使用 < 而不是 ≤)或交换中的逻辑错误。始终测试边界值,如空列表、单个元素或目标值不存在的情况。

A trace table for a bubble sort on [4,3,2,1] might show the swap steps and the gradually sorted list. Practice building trace tables on past paper questions.

对 [4,3,2,1] 进行冒泡排序的跟踪表可以展示交换步骤以及逐渐排序的列表。在历年真题上练习构建跟踪表。


10. Introduction to Algorithm Efficiency | 算法效率简介

Efficiency measures how well an algorithm uses time and memory. A linear search takes time proportional to the list size (O(n)), while binary search takes logarithmic time (O(log n)), making it much faster for large sorted lists.

效率衡量算法使用时间和内存的程度。线性搜索所需时间与列表大小成正比(O(n)),而二分搜索所需时间为对数级别(O(log n)),因此对于大的有序列表,它要快得多。

Bubble sort has quadratic time complexity (O(n²)) in the worst case, so it is inefficient for large datasets. More advanced algorithms like merge sort are used for better performance.

冒泡排序在最坏情况下具有平方时间复杂度(O(n²)),因此对于大数据集效率低下。更高级的算法,如归并排序,被用于获得更好的性能。

While you do not need to calculate O notation for GCSE, recognising that different algorithms have different trade-offs is part of algorithmic thinking.

虽然 GCSE 不需要计算 O 表示法,但认识到不同算法有不同的权衡是算法思维的一部分。


11. Algorithms in the Real World | 现实世界中的算法

Algorithms are everywhere—from GPS navigation finding the shortest route to search engines ranking web pages. In finance, algorithms automate trading; in healthcare, they help analyze medical images.

算法无处不在——从 GPS 导航寻找最短路线到搜索引擎对网页排序。在金融领域,算法实现自动化交易;在医疗保健领域,它们帮助分析医学影像。

Understanding basic algorithms builds a foundation for computational thinking, which is valuable in many fields. Even everyday tasks like following a recipe are algorithmic in nature.

理解基本算法为计算思维奠定基础,这在许多领域都很有价值。即使是

Published by TutorHao | GCSE Mathematics Revision Series | aleveler.com

广告 / Sponsored
官网正版 国际课程数学核心词汇 唯寻国际教育 全英 学科 GCSE A Level IB MYP IB IBDP 美高…
数学 备考教辅 · 正版现货 · 与本文内容相关
查看详情 / View on Taobao参考价 ¥19.7

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao