📚 Algorithms for OCR GCSE Maths | OCR GCSE 数学算法考点精讲
An algorithm is a precise set of instructions that can be followed to solve a problem or complete a task. In OCR GCSE Maths, you need to be able to understand, interpret, and even design algorithms, often using flowcharts or pseudocode. This revision guide covers the essential algorithms and concepts you must know for the exam, from basic arithmetic procedures to searching, sorting, and iterative methods for solving equations.
算法是一组精确的指令,可以遵循它来解决问题或完成任务。在 OCR GCSE 数学考试中,你需要能够理解、解释甚至设计算法,通常使用流程图或伪代码。本复习指南涵盖了你必须掌握的必备算法和概念,从基本的算术步骤到搜索、排序以及求解方程的迭代方法。
1. What is an Algorithm? | 什么是算法?
An algorithm is a finite sequence of well-defined steps that takes an input and produces an output. Algorithms must be unambiguous, effective, and eventually halt. In everyday life, a recipe is a simple algorithm.
算法是一系列定义明确的有限步骤,接收输入并产生输出。算法必须明确、有效且最终停止。在日常生活中,食谱就是一个简单的算法。
In mathematics, algorithms are used to perform calculations, make decisions, and process data. They are the foundation of computer programming but can be executed by humans as well. Exam questions will often ask you to trace through an algorithm or identify its purpose.
在数学中,算法用于执行计算、做出决策和处理数据。它们是计算机编程的基础,但也可以由人执行。考试题目通常会要求你跟踪执行算法或确定其用途。
2. Representing Algorithms: Flowcharts and Pseudocode | 算法的表示:流程图与伪代码
Algorithms can be shown visually using flowcharts. Standard symbols include: oval for Start/End, rectangle for a process or instruction, diamond for a decision (yes/no), and parallelogram for input/output. Arrows show the flow of control.
算法可以用流程图直观地表示。常用的符号包括:椭圆表示开始/结束,矩形表示处理或指令,菱形表示判断(是/否),平行四边形表示输入/输出。箭头表示控制流向。
Pseudocode is a text-based way to write algorithms using structured English. It avoids programming language syntax but uses keywords like WHILE, IF…THEN…ELSE, FOR, and OUTPUT. For example:
伪代码是一种使用结构化英语编写算法的文本方式。它避免编程语言语法,但使用诸如 WHILE、IF…THEN…ELSE、FOR 和 OUTPUT 等关键字。例如:
INPUT number total ← 0 WHILE number > 0 total ← total + number INPUT number ENDWHILE OUTPUT total
This pseudocode keeps asking for numbers and sums them until you enter zero or a negative number. Understanding how to read and write both representations is essential for the exam.
这段伪代码不断要求输入数字并求和,直到输入零或负数为止。理解如何阅读和书写这两种表示法对考试至关重要。
3. Standard Written Algorithms for Arithmetic | 标准算术书面算法
You are expected to be able to carry out the standard column methods for addition, subtraction, multiplication and division without a calculator. These algorithms guarantee correct results if performed accurately.
你需要能够不使用计算器,执行标准的列竖式加法、减法、乘法和除法。只要准确执行,这些算法就能保证正确结果。
For example, the column addition algorithm aligns digits by place value, adds each column from right to left, and carries any extra to the next column. The long multiplication algorithm breaks the multiplier into place values and sums the partial products. The short division (bus stop) algorithm processes digits from left to right, recording remainders and carrying them to the next digit.
例如,列竖式加法算法按位数对齐数字,从右到左逐列相加,并将任何进位带入下一列。长乘法算法将乘数分解为位值,并合计部分乘积。短除法(“公交车站”法)从左到右处理数字,记录余数并将其带入下一位数。
Being fluent in these written algorithms helps you handle large numbers and decimals confidently. Practice by working through multi-digit calculations and checking your answers with estimation.
熟练掌握这些书面算法有助于你自信地处理大数和小数。通过完成多位数计算并用估计检查答案来进行练习。
4. Euclidean Algorithm for HCF | 求最大公因数的欧几里得算法
The Euclidean algorithm is an ancient and efficient method for finding the highest common factor (HCF) of two integers. It is based on the principle that HCF(a, b) = HCF(b, a mod b), repeating until the remainder is zero.
欧几里得算法是一种古老而高效的寻找两个整数最大公因数(HCF)的方法。它基于这样一个原理:HCF(a, b) = HCF(b, a mod b),重复直到余数为零。
To find the HCF of 48 and 18: divide 48 by 18, remainder 12; then divide 18 by 12, remainder 6; then divide 12 by 6, remainder 0. The last non-zero remainder, 6, is the HCF. In pseudocode:
要计算 48 和 18 的 HCF:48 除以 18 余 12;然后 18 除以 12 余 6;然后 12 除以 6 余 0。最后一个非零余数 6 就是 HCF。伪代码如下:
FUNCTION HCF(a, b)
WHILE b ≠ 0
r ← a MOD b
a ← b
b ← r
ENDWHILE
RETURN a
This algorithm is particularly useful for large numbers where listing factors is impractical. You may be asked to trace the algorithm for given values or complete a flowchart.
该算法对于列举因数不切实际的大数特别有用。你可能需要根据给定的数值追踪算法或完成流程图。
5. Sieve of Eratosthenes for Prime Numbers | 埃拉托色尼筛法求质数
The Sieve of Eratosthenes is a classic algorithm for finding all prime numbers up to a given limit, say 100. You start with a list of integers from 2 to the limit, then repeatedly remove multiples of the smallest remaining number.
埃拉托色尼筛法是一种经典的算法,用于找出所有不超过给定上限(例如 100)的质数。你从列出 2 到上限的整数开始,然后反复划掉剩余数中最小数的倍数。
Step-by-step: write numbers 2 to 100; let p = 2, the first prime. Cross out all multiples of 2 (4, 6, 8…). Move to the next uncrossed number, 3, and cross out its multiples (6, 9, 12…). Continue with 5, 7, and so on. Stop when p × p is greater than the limit. The uncrossed numbers are primes.
逐步操作:写下 2 到 100 的数字;设 p = 2,即第一个质数。划掉所有 2 的倍数(4、6、8…)。移动到下一个未被划掉的数字 3,划掉其倍数(6、9、12…)。继续处理 5、7 等。当 p × p 大于上限时停止。未被划掉的数字就是质数。
An algorithm for the sieve can be expressed using a FOR loop and an array of Boolean values. Exam questions might ask you to apply the sieve for a small range or explain why it works.
筛法的算法可以用 FOR 循环和布尔数组表示。试题可能会要求你将筛法应用于一个小范围,或解释其原理。
6. Iteration: Trial and Improvement | 迭代
Published by TutorHao | GCSE Mathematics Revision Series | aleveler.com
更多咨询请联系16621398022(同微信)
屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导