📚 Algorithms in IGCSE CCEA Mathematics: Key Points | IGCSE CCEA 数学:算法 考点精讲
Algorithms form the backbone of systematic problem solving in mathematics. In the CCEA IGCSE Mathematics curriculum, understanding and applying standard algorithms—from basic arithmetic procedures to iterative methods for solving equations—is essential. An algorithm is simply a finite sequence of well-defined steps that solves a specific problem. This article covers the key algorithmic concepts you need to master, with clear explanations, worked examples, and visual aids.
算法是数学中系统化问题解决的基石。在 CCEA IGCSE 数学课程中,理解和应用标准算法——从基本的算术步骤到解方程的迭代方法——至关重要。算法就是一组解决特定问题的精确定义的有限步骤。本文涵盖了你需要掌握的关键算法概念,并提供清晰的解释、例题和可视化辅助。
1. What is an Algorithm? | 算法是什么?
An algorithm is a step-by-step procedure for carrying out a calculation or solving a problem. Just like a recipe for baking a cake, an algorithm must be precise, unambiguous, and produce the correct result after a finite number of steps. In mathematics, algorithms appear in everything from column addition to finding roots of equations.
算法是执行计算或解决问题的分步过程。就像烘焙蛋糕的食谱一样,算法必须精确、无歧义,并在有限步骤后产生正确结果。在数学中,算法出现在从竖式加法到求方程根的所有领域。
Key characteristics of an algorithm include: it must have a clearly defined input and output, each step must be executable exactly, and it must terminate. For example, the algorithm for adding two three-digit numbers involves aligning columns, adding digits from right to left, and carrying over if a sum exceeds 9.
算法的关键特征包括:必须有明确定义的输入和输出,每一步都可准确执行,并且必须终止。例如,两个三位数相加的算法包括对齐数位、从右向左逐位相加、如果和超过9则进位。
2. Standard Arithmetic Algorithms | 标准算术算法
Arithmetic algorithms are the fundamental building blocks of all numerical mathematics. The four main operations—addition, subtraction, multiplication, and division—each have a standard written method taught in CCEA mathematics. For instance, the column addition algorithm for 456 + 278 works as follows: write the numbers one under the other, ensuring units, tens, and hundreds are aligned; add the units: 6 + 8 = 14, write 4 in the units column and carry 1 to the tens; then 5 + 7 + 1 = 13, write 3 and carry 1; finally 4 + 2 + 1 = 7, giving 734.
算术算法是所有数值数学的基础。四种基本运算——加、减、乘、除——在 CCEA 数学中都有标准的笔算方法。例如,456 + 278 的列式加法算法如下:将一个数写在另一个数下方,确保个位、十位和百位对齐;从个位加起:6 + 8 = 14,个位写 4,向十位进 1;然后 5 + 7 + 1 = 13,写 3 进 1;最后 4 + 2 + 1 = 7,结果是 734。
Long multiplication, such as 34 × 27, uses the distributive law: multiply 34 by 7 (units), then by 20 (tens), and add the partial products. The standard algorithm breaks this into manageable steps. Long division, exemplified by 823 ÷ 5, proceeds by repeatedly taking multiples of the divisor and subtracting. These algorithms emphasise place value and the logical structure of arithmetic.
长乘法,如 34 × 27,使用分配律:先将 34 乘 7(个位),再乘 20(十位),然后叠加部分积。标准算法将此分解为可管理的步骤。以 823 ÷ 5 为例的长除法,通过反复取除数的倍数并相减来进行。这些算法强调位值和算术的逻辑结构。
| Step | Action |
|---|---|
| 1 | Set up: 823 inside the division bracket, 5 outside. |
| 2 | Divide 8 by 5: quotient 1, remainder 3. Bring down 2 → 32. |
| 3 | Divide 32 by 5: quotient 6, remainder 2. Bring down 3 → 23. |
| 4 | Divide 23 by 5: quotient 4, remainder 3. Result: 164 r 3. |
823 ÷ 5 = 164 remainder 3
3. Euclidean Algorithm for HCF/GCD | 欧几里得算法求最大公约数
The Euclidean algorithm is an ancient and efficient method for finding the highest common factor (HCF) of two integers, also called the greatest common divisor (GCD). It is based on the principle that gcd(a, b) = gcd(b, a mod b), and you repeat this until the remainder becomes zero.
欧几里得算法是求两个整数最大公因数(HCF,也称最大公约数 GCD)的古老且高效的方法。它基于这样一个原理:gcd(a, b) = gcd(b, a mod b),重复此过程直到余数为零。
To find the HCF of 48 and 18: 48 ÷ 18 = 2 remainder 12; now compute gcd(18, 12): 18 ÷ 12 = 1 remainder 6; then gcd(12, 6): 12 ÷ 6 = 2 remainder 0. The last non-zero remainder is 6, so HCF(48, 18) = 6. This algorithm avoids the need to list all factors, making it especially useful for large numbers.
要求 48 和 18 的 HCF:48 ÷ 18 = 2 余 12;计算 gcd(18, 12):18 ÷ 12 = 1 余 6;然后 gcd(12, 6):12 ÷ 6 = 2 余 0。最后一个非零余数是 6,因此 HCF(48, 18) = 6。此算法避免了列出所有因数的需要,对大数特别有用。
gcd(a, b) = gcd(b, r) where a = bq + r, 0 ≤ r < b
4. Sieve of Eratosthenes for Prime Numbers | 埃拉托色尼筛法求质数
The Sieve of Eratosthenes is a classic algorithm for finding all prime numbers up to a given limit. Starting from a list of consecutive integers from 2 onward, you repeatedly take the next unmarked number (which must be prime) and mark all its multiples as composite. The numbers left unmarked are primes.
埃拉托色尼筛法是一种寻找不超过给定上限的所有质数的经典算法。从 2 开始的连续整数列表出发,反复取下一个未被标记的数(它必为质数),然后将其所有倍数标记为合数。最后未被标记的数就是质数。
Example for limit 30: list numbers 2 to 30. Mark 2 as prime, then cross out multiples 4,6,8,…,30. Next unmarked is 3; mark prime, cross out multiples 9,15,21,27 (already some crossed). Continue with 5, then 7. Primes up to 30: 2,3,5,7,11,13,17,19,23,29. This algorithm is extremely efficient for generating prime lists and demonstrates the power of systematic elimination.
以 30 为上限的示例:列出 2 到 30 的数。将 2 标记为质数,然后划掉 4,6,8,…,30。下一个未标记的是 3;标记质数,划掉 9,15,21,27(有些已划掉)。继续 5,然后 7。30 以内的质数:2,3,5,7,11,13,17,19,23,29。此算法生成质数列表的效率极高,展示了系统性排除法的力量。
5. Prime Factorization using Factor Trees | 用因子树进行质因数分解
A factor tree is a graphical algorithm to decompose a composite number into its prime factors. Starting with the original number, you repeatedly split any composite factor into a pair of smaller factors, until all branches end in prime numbers. The product of these primes equals the original number.
因子树是将合数分解为其质因数的图形化算法。从原数出发,反复将任一合数因子拆分成一对更小的因子,直到所有分支末端都是质数。这些质数的乘积等于原数。
To factorise 60: start with 60 → 6 × 10. Then split 6 into 2 × 3 (both primes), and 10 into 2 × 5. The prime factors collected are 2, 2, 3, 5, so 60 = 2² × 3 × 5. A systematic algorithm can be written: while the number is not prime, find the smallest divisor greater than 1 and divide; repeat with the quotient.
分解 60:从 60 开始 → 6 × 10。然后将 6 分成 2 × 3(均为质数),10 分成 2 × 5。收集到的质因数为 2, 2, 3, 5,因此 60 = 2² × 3 × 5。可以写成一个系统算法:当数字不是质数时,找出大于 1 的最小除数并除之;用商重复此步骤。
6. Binary Search (Bisection Method) | 二分搜索(二分法)
The bisection method is a root-finding algorithm that repeatedly halves an interval in which a continuous function changes sign. Because of the sign change, a root must exist in the interval. The midpoint of the interval is tested, and the interval is replaced by the half containing the sign change. This process is repeated until the interval is sufficiently small.
二分法是一种求根算法,它反复将连续函数变号的区间对半分。由于发生了变号,该区间内必有一根。测试区间的中点,然后将区间替换为包含变号的那一半。重复此过程直到区间足够小。
For example, to solve x³ – x – 1 = 0 between 1 and 2: f(1) = -1 (negative), f(2) = 5 (positive). Midpoint m = 1.5; f(1.5) = 1.875 (positive), so root lies in [1, 1.5]. Next m = 1.25; f(1.25) ≈ -0.297 (negative), interval becomes [1.25, 1.5]. After several iterations, the root approximates 1.3247. This algorithm is simple, reliable, and converges steadily.
例如,求解 x³ – x – 1 = 0 在 1 和 2 之间的根:f(1) = -1(负),f(2) = 5(正)。中点 m = 1.5;f(1.5) = 1.875(正),因此根在 [1, 1.5] 内。下一个 m = 1.25;f(1.25) ≈ -0.297(负),区间变为 [1.25, 1.5]。经过数次迭代后,根逼近 1.3247。该算法简单可靠,稳定收敛。
m = (a + b) / 2; if f(a)·f(m) < 0 then b = m else a = m
7. Newton-Raphson Method | 牛顿-拉夫森方法
The Newton-Raphson method is an iterative technique for finding successively better approximations to the roots of a real-valued function. Starting from an initial guess x₀, it uses the tangent at that point to intersect the x-axis, giving a new estimate x₁. The formula is xₙ₊₁ = xₙ – f(xₙ)/f'(xₙ), provided f'(xₙ) ≠ 0. This method converges quadratically when the initial guess is close to the actual root.
牛顿-拉夫森方法是一种迭代技术,用于逐次寻找实值函数根的更好近似值。从初始猜测值 x₀ 开始,它利用该点处的切线与 x 轴相交,得到新估计值 x₁。公式为 xₙ₊₁ = xₙ – f(xₙ)/f'(xₙ),前提是 f'(xₙ) ≠ 0。当初值接近真实根时,该方法呈二次收敛。
Let us approximate √2 by solving x² – 2 = 0. Here f(x)=x²-2, f'(x)=2x. Choose x₀ = 1.5. Then x₁ = 1.5 – (1.5²-2)/(2×1.5) = 1.5 – 0.25/3 ≈ 1.4167. Next, x₂ = 1.4167 – (1.4167²-2)/(2×1.4167) ≈ 1.4142, which is correct to four decimal places. This algorithm is widely used due to its speed.
我们通过解 x² – 2 = 0 来逼近 √2。这里 f(x)=x²-2,f'(x)=2x。取 x₀ = 1.5。则 x₁ = 1.5 – (1.5²-2)/(2×1.5) = 1.5 – 0.25/3 ≈ 1.4167。下一步,x₂ = 1.4167 – (1.4167²-2)/(2×1.4167) ≈ 1.4142,精确到小数点后四位。该算法因其速度快而被广泛使用。
x₁ = x₀ – f(x₀)/f'(x₀)
8. Trial and Improvement Method | 试错法
Trial and improvement (also called iterative refinement) is an intuitive algorithm often used when direct algebraic solution is difficult. You substitute a guessed value, compare the result with the target, and then choose a better guess based on whether the result is too high or too low. This repeats until the required precision is reached.
试错法(也称迭代改进法)是一种直观的算法,常用于难以直接代数求解的情况。代入一个猜测值,将结果与目标比较,然后根据结果过高还是过低选择一个更好的猜测。重复此过程直到达到所需精度。
For instance, solve x³ + x = 20. Try x = 2: 2³+2=10 (too low). Try x = 3: 27+3=30 (too high). So the solution lies between 2 and 3. Try x = 2.5: 15.625+2.5=18.125 (too low). Try 2.6: 17.576+2.6=20.176 (slightly high). Continue to narrow down: 2.59 gives 20.00 (approx). The algorithm documents a trail of refinements, showing systematic approximation.
例如,解方程 x³ + x = 20。尝试 x = 2:2³+2=10(太低)。尝试 x = 3:27+3=30(太高)。因此解在 2 到 3 之间。尝试 x = 2.5:15.625+2.5=18.125(太低)。尝试 2.6:17.576+2.6=20.176(略高)。继续缩窄:2.59 得约 20.00。该算法记录了一系列改进,展示了系统逼近的过程。
9. Sorting Algorithms – Bubble Sort | 排序算法 – 冒泡排序
While sorting is more common in computer science, CCEA mathematics may include algorithmic thinking with simple sort procedures. Bubble sort works by repeatedly stepping through a list, comparing adjacent elements, and swapping them if they are in the wrong order. Passes are repeated until no swaps are needed, meaning the list is sorted.
虽然排序在计算机科学中更常见,但 CCEA 数学可能涉及使用简单排序过程的算法思维。冒泡排序的工作原理是反复遍历列表,比较相邻元素,如果顺序错误则交换它们。重复遍历直到不需要任何交换,即列表已排序。
Example: Sort [5, 1, 4, 2, 8] in ascending order. First pass: compare 5 and 1 → swap → [1,5,4,2,8]; 5 and 4 → swap → [1,4,5,2,8]; 5 and 2 → swap → [1,4,2,5,8]; 5 and 8 → no swap. Second pass: 1 and 4 ok; 4 and 2 → swap → [1,2,4,5,8]; rest ok. Third pass: no swaps, list sorted. This algorithm reinforces comparison and logical sequencing.
示例:对 [5, 1, 4, 2, 8] 进行升序排序。第一遍:比较 5 和 1 → 交换 → [1,5,4,2,8];5 和 4 → 交换 → [1,4,5,2,8];5 和 2 → 交换 → [1,4,2,5,8];5 和 8 → 不交换。第二遍:1 和 4 正确;4 和 2 → 交换 → [1,2,4,5,8];其余正确。第三遍:无交换,列表已排序。此算法强化了比较和逻辑顺序。
10. Using Flowcharts to Design Algorithms | 使用流程图设计算法
A flowchart is a visual representation of an algorithm, using standard symbols: an oval for start/end, a parallelogram for input/output, a rectangle for a processing step, and a diamond for a decision. Drawing a flowchart helps to plan the logical flow of a solution before writing precise steps or code.
流程图是算法的可视化表示,使用标准符号:椭圆表示开始/结束,平行四边形表示输入/输出,矩形表示处理步骤,菱形表示判断。在编写精确步骤或代码之前,绘制流程图有助于规划解决方案的逻辑流程。
For example, an algorithm to check if a number is even: start, input a number n. Diamond: “Is n mod 2 = 0?” If yes, output “Even”; else output “Odd”. Then end. This simple flowchart shows sequence and selection. In CCEA exams, you may be asked to complete a flowchart or interpret one for a given problem.
例如,判断一个数是否为偶数的算法:开始,输入数字 n。菱形:“n mod 2 = 0 吗?”若是,输出“偶数”;否则输出“奇数”。然后结束。这个简单的流程图展示了顺序和选择结构。在 CCEA 考试中,你可能被要求完成流程图或解读给定问题的流程图。
- Oval: Start / End
- Parallelogram: Enter n or Print result
- Rectangle: n mod 2
- Diamond: Decision based on condition
椭圆:开始/结束;平行四边形:输入 n 或输出结果;矩形:n mod 2 计算;菱形:基于条件的判断。
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课程辅导,国外大学本科硕士研究生博士课程论文辅导