Edexcel A-Level Programming: Core Concepts and Algorithms | Edexcel A-Level 编程:核心概念与算法

📚 Edexcel A-Level Programming: Core Concepts and Algorithms | Edexcel A-Level 编程:核心概念与算法

Programming is the practical foundation of the Edexcel A-Level Computer Science specification. This guide walks through the essential constructs, data structures, algorithms and development practices that you are expected to understand, apply and evaluate in Paper 1 and Paper 2.

编程是 Edexcel A-Level 计算机科学考试大纲的实践基础。本指南涵盖你在 Paper 1 和 Paper 2 中需要理解、应用和评估的基本结构、数据结构、算法和开发实践。


1. Programming Paradigms | 编程范式

A programming paradigm is a style or way of thinking about writing code. Edexcel expects you to compare procedural, object-oriented and low-level approaches, and to justify the choice of paradigm for a given problem.

编程范式是一种编写代码的风格或思维方式。Edexcel 要求你比较过程式、面向对象和低级编程方法,并能为给定问题选择范式并说明理由。

In procedural programming, a problem is broken down into a sequence of instructions and reusable procedures. In object-oriented programming, data and behaviour are grouped into classes and objects, supporting encapsulation and inheritance.

在过程式编程中,问题被分解为一系列指令和可重用过程。在面向对象编程中,数据和行为被组合成类和对象,从而支持封装和继承。


2. Data Types and Variables | 数据类型与变量

Variables are named memory locations that store data during program execution. Each variable has a data type that determines what values it can hold and what operations can be performed on it.

变量是在程序执行期间存储数据的命名内存位置。每个变量都有一种数据类型,决定了它可以保存哪些值以及可以对它执行哪些操作。

Common primitive data types include integer, real, Boolean, character and string. Choosing the correct data type is important for memory efficiency and for avoiding type errors.

常见的原始数据类型包括整型、实型、布尔型、字符型和字符串型。选择正确的数据类型对于内存效率和避免类型错误非常重要。


3. Operators and Expressions | 运算符与表达式

Operators are symbols that perform operations on operands. Arithmetic operators include +, −, ×, ÷ and MOD, while comparison operators include =, ≠, <, >, ≤ and ≥.

运算符是对操作数执行操作的符号。算术运算符包括 +、−、×、÷ 和 MOD,比较运算符包括 =、≠、<、>、≤ 和 ≥。

Boolean operators AND, OR and NOT are used to combine conditions. The truth tables for these operators must be memorised for questions on logic and condition evaluation.

布尔运算符 AND、OR 和 NOT 用于组合条件。这些运算符的真值表必须牢记,以应对逻辑和条件求值相关问题。

total ← price × quantity + delivery


4. Selection and Iteration | 选择与迭代

Selection allows a program to choose between different paths. The main selection constructs are IF…THEN…ELSE and CASE statements.

选择结构允许程序在不同路径之间进行选择。主要的选择结构是 IF…THEN…ELSE 和 CASE 语句。

Iteration allows a block of code to repeat. Definite iteration uses FOR loops when the number of repetitions is known, while indefinite iteration uses WHILE or REPEAT…UNTIL loops when the repetition depends on a condition.

迭代结构允许一段代码重复执行。当重复次数已知时使用计数控制的 FOR 循环;当重复取决于条件时使用条件控制的 WHILE 或 REPEAT…UNTIL 循环。

WHILE score < 50 DO score ← score + 10


5. Subprograms and Parameters | 子程序与参数

Subprograms, including procedures and functions, allow large problems to be split into smaller, manageable modules. A function returns a value, while a procedure does not.

子程序(包括过程和函数)可以将大型问题拆分为更小、更易于管理的模块。函数会返回一个值,而过程不会返回值。

Parameters pass data into subprograms. Value parameters copy the original value, so changes inside the subprogram do not affect the caller. Reference parameters pass the address, so changes do affect the caller.

参数将数据传入子程序。值参数复制原始值,因此子程序内部的更改不会影响调用者。引用参数传递地址,因此更改会影响调用者。


6. Arrays and Lists | 数组与列表

An array is a static data structure that stores elements of the same data type in contiguous memory locations. Elements are accessed by an index, typically starting at 0 or 1.

数组是一种静态数据结构,在连续的内存位置中存储相同数据类型的数据元素。元素通过索引访问,通常从 0 或 1 开始。

A list is a dynamic data structure that can grow and shrink at runtime. Lists support operations such as append, insert, remove and search.

列表是一种动态数据结构,可以在运行时增长和缩小。列表支持追加、插入、删除和查找等操作。

  • Array: fixed size, direct access, memory efficient
  • List: dynamic size, flexible insertion and deletion
  • 数组:固定大小,可直接访问,内存效率高
  • 列表:动态大小,插入和删除灵活

7. Stacks and Queues | 栈与队列

A stack is a Last In First Out data structure. The primary operations are push to add an item and pop to remove the most recently added item.

栈是一种后进先出的数据结构。主要操作是 push 用于添加元素,pop 用于移除最近添加的元素。

A queue is a First In First Out data structure. Items are added at the rear and removed from the front, making queues useful for scheduling and buffering.

队列是一种先进先出的数据结构。元素在队尾添加,在队首移除,因此队列适用于调度和缓冲。

Stacks are used in recursion, expression evaluation and undo features. Queues are used in printer spooling, keyboard buffers and breadth-first search.

栈用于递归、表达式求值和撤销功能。队列用于打印池、键盘缓冲和广度优先搜索。


8. Searching and Sorting Algorithms | 搜索与排序算法

Linear search checks each element in sequence. It works on unsorted data and has worst-case time complexity O(n). Binary search repeatedly halves a sorted list and has time complexity O(log n).

线性搜索按顺序检查每个元素。它适用于未排序的数据,最坏时间复杂度为 O(n)。二分搜索不断将有序列表减半,时间复杂度为 O(log n)。

Bubble sort repeatedly compares adjacent items and swaps them if they are in the wrong order. Merge sort divides the list into halves, sorts each half recursively and merges them.

冒泡排序反复比较相邻元素,如果顺序错误则交换它们。归并排序将列表分成两半,递归地对每一半排序然后合并。

Algorithm Best case Worst case
Linear search O(1) O(n)
Binary search O(1) O(log n)
Bubble sort O(n) O(n²)
Merge sort O(n log n) O(n log n)

9. Recursion and Trace Tables | 递归与跟踪表

Recursion is a technique where a subprogram calls itself. Every recursive routine must have a base case to stop the recursion and a recursive case that moves toward the base case.

递归是一种子程序调用自身的技术。每个递归例程必须有一个终止递归的基准情形,以及一个使问题逐步接近基准情形的递归情形。

A trace table records the values of variables at each step of an algorithm. It is a vital tool for testing logic, identifying errors and answering exam questions involving loops, recursion and arrays.

跟踪表记录算法每一步的变量值。它是测试逻辑、识别错误以及解答涉及循环、递归和数组考题的重要工具。

fib(n) = fib(n−1) + fib(n−2), with fib(1) = fib(2) = 1


10. Object-Oriented Programming | 面向对象编程

Object-oriented programming organises code into classes and objects. A class is a blueprint, while an object is an instance of a class with its own state and behaviour.

面向对象编程将代码组织为类和对象。类是蓝图,而对象是具有自身状态和行为的类实例。

Encapsulation hides internal data and only exposes necessary methods. Inheritance allows a subclass to reuse and extend the features of a superclass, while polymorphism lets different objects respond to the same method call in different ways.

封装隐藏内部数据,只暴露必要的方法。继承允许子类重用和扩展父类的特性,而多态让不同对象能够以不同方式响应同一方法调用。


11. Translators and Development Tools | 翻译器与开发工具

A compiler translates the entire source code into machine code before execution. An interpreter translates and executes source code line by line, which makes debugging easier but often runs more slowly.

编译器在执行之前将整个源代码翻译为机器代码。解释器逐行翻译并执行源代码,这使调试更容易但运行通常更慢。

An assembler converts assembly language into machine code. Assemblers are specific to a processor architecture and produce very efficient low-level code.

汇编器将汇编语言转换为机器代码。汇编器针对特定处理器架构,并能生成非常高效的低级代码。

An integrated development environment typically includes a code editor, translator, debugger, auto-completion, breakpoints and step-through tools to support the software development process.

集成开发环境通常包括代码编辑器、翻译器、调试器、自动补全、断点和单步执行工具,以支持软件开发过程。


12. Testing and Debugging | 测试与调试

Testing ensures that a program meets its requirements and handles invalid input correctly. Normal, boundary and erroneous test data should be used to cover all important paths.

测试确保程序满足其需求并能正确处理无效输入。应使用正常、边界和错误测试数据覆盖所有重要路径。

Debugging is the process of finding and correcting errors. Syntax errors break language rules, logic errors produce wrong results, and runtime errors occur during execution such as division by zero or stack overflow.

调试是发现并纠正错误的过程。语法错误违反语言规则,逻辑错误产生错误结果,运行时错误在执行期间发生,例如除以零或栈溢出。

Maintainability is improved through meaningful identifiers, modular design, comments, constants instead of magic numbers, and consistent indentation.

通过使用有意义的标识符、模块化设计、注释、用常量代替魔数以及一致的缩进,可以提高程序的可维护性。


Published by TutorHao | Programming Revision Series | aleveler.com

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

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading