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

Programming Fundamentals for Edexcel A-Level Computer Science | Edexcel A-Level 计算机科学编程基础

2026-08-29 15:27 · 本文部分内容由AI辅助创作

📚 Programming Fundamentals for Edexcel A-Level Computer Science | Edexcel A-Level 计算机科学编程基础

Programming is the core skill tested across Edexcel A-Level Computer Science, especially in the on-screen examination and the programming project. This guide brings together the fundamental techniques you need, including data representation, control flow, recursion, data structures, searching and sorting, object-oriented design, and algorithm analysis.

编程是 Edexcel A-Level 计算机科学中贯穿始终的核心技能,尤其在机考与编程项目中尤为重要。本指南汇集了你需要掌握的基础技术,包括数据表示、控制流、递归、数据结构、搜索与排序、面向对象设计以及算法分析。

The material below follows the order in which the topics usually appear in lessons: start with computational thinking, move through the way data is stored and manipulated, then build up programs with control flow, subprograms and recursion, before studying the data structures and algorithms that examiners expect you to select and justify. Each section ends with the vocabulary and the typical exam phrasing you should be able to recognise instantly.

下文按照课堂中常见的教学顺序展开:先讲计算思维,再讲数据的存储与运算方式,然后用控制流、子程序和递归搭建程序,最后学习数据结构与算法 —— 这些都是考官希望你能够选择并给出理由的内容。每一节最后都会点出你需要一眼认出的专业术语和典型考题措辞。


1. Computational Thinking and Problem Decomposition | 计算思维与问题分解

Computational thinking means approaching a problem in a way that a computer can execute. It involves abstraction, which removes unnecessary detail; decomposition, which breaks a large problem into manageable parts; pattern recognition, which identifies similarities; and algorithm design, which specifies step-by-step instructions.

计算思维意味着以计算机能够执行的方式来处理问题。它包括抽象(去除不必要的细节)、分解(把大问题拆成可管理的小块)、模式识别(找出相似之处)以及算法设计(给出逐步执行的指令)。

A well-formed algorithm has clearly defined inputs and outputs, uses only operations the computer can perform, and reaches the same output for the same input every time. When a question says 'state the inputs and outputs of your solution', it is testing whether you have abstracted the problem correctly rather than started writing code immediately.

一个规范的算法要有明确定义的输入与输出,只使用计算机能够执行的运算,并且对相同输入每次都得到相同输出。当题目要求"写出解法的输入和输出"时,它其实是在检验你是否正确地做了抽象,而不是急着开始写代码。

Inputs → Process(es) → Outputs (finite, unambiguous, correct, efficient)


2. Data Representation Inside a Program | 程序内部的数据表示

Every value a program manipulates is ultimately stored as binary, so you must move fluently between denary, binary and hexadecimal, handle signed integers with two's complement, and interpret floating-point values as a mantissa and an exponent. Character data uses character sets such as ASCII and Unicode, while Boolean values and bitwise operators underpin many low-level tasks.

程序处理的每一个值最终都以二进制存储,因此你必须能在十进制、二进制和十六进制之间流畅转换,用补码处理有符号整数,并把浮点数理解为一个尾数加一个指数。字符数据使用 ASCII、Unicode 之类的字符集,而布尔值与按位运算符则支撑着许多底层操作。

n-bit two's complement range: −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1

floating-point value = mantissa × 2^exponent

广告 / Sponsored


3. Control Flow: Sequence, Selection and Iteration | 控制流:顺序、选择与迭代

All programs are built from just three constructs: sequence, selection and iteration. Selection uses if, elseif and else statements or a switch/case block; iteration uses for loops when the number of repetitions is known in advance and while or do-while loops when it is not. Mastering nesting and loop control is what turns a novice solution into a full-mark solution.

所有程序都只由三种结构组成:顺序、选择和迭代。选择使用 if、elseif、else 语句或 switch/case 分支;迭代在循环次数已知时使用 for 循环,次数未知时使用 while 或 do-while 循环。掌握嵌套与循环控制,是新手解法与满分解法之间的差别。

while (index < length) AND (list[index] ≠ target) do index ← index + 1 endwhile


4. Subprograms, Parameters and Scope | 子程序、参数与作用域

Subprograms make a program modular: a procedure performs an action without returning a value, while a function returns a single value. Data passes into them through parameters, which may be passed by value (a copy is used) or by reference (the original variable is used and can be modified). Understanding scope prevents the most common debugging headaches.

子程序让程序模块化:过程执行某个动作但不返回值,函数则返回一个值。数据通过参数传入,参数可以按值传递(使用副本)或按引用传递(使用原变量并且可以被修改)。理解作用域能避免最常见的调试困扰。


5. Recursion and Divide-and-Conquer | 递归与分治

Recursion is a technique in which a subprogram calls itself with a smaller version of the same problem. Every recursive solution needs a base case that stops the recursion and a general case that moves the problem closer to that base case. Without a base case the call stack grows until a stack overflow occurs.

递归是一种子程序用同一问题的更小版本来调用自身的技术。每个递归解法都需要一个停止递归的基本情况(base case)和一个让问题更接近该基本情况的通用情况。没有基本情况时,调用栈会不断增长,最终导致栈溢出。

Recursion is elegant and often shorter than the equivalent iterative solution, but each call consumes memory on the call stack and the repeated work can be inefficient. Iteration is usually faster and uses constant memory, so examiners frequently ask you to compare the two.

递归优雅且往往比等价的迭代解法更简短,但每次调用都会占用调用栈内存,重复计算也可能导致效率低下。迭代通常更快且只使用常量内存,因此考官经常要求你比较这两种方式。

factorial(n) = n × factorial(n − 1), with factorial(0) = 1


6. Data Structures and Their Operations | 数据结构及其操作

Choosing the right data structure is often worth more marks than writing clever code. Static arrays have fixed size and constant-time access by index; dynamic lists can grow; stacks and queues restrict access in ways that match real problems; hash tables, trees and graphs support fast searching and modelling of relationships.

选择正确的数据结构往往比写出"聪明"的代码更能得分。静态数组大小固定,按索引访问是常数时间;动态列表可以增长;栈和队列用受限的访问方式匹配真实问题;哈希表、树和图则支持快速查找和对关系的建模。

StructureKey operationsTypical cost
Array / listread, write, append, insertread O(1), insert O(n)
Stack (LIFO)push, pop, peekO(1)
Queue (FIFO)enqueue, dequeueO(1)
Linked listinsert, delete, traverseinsert O(1), search O(n)
Hash tableinsert, lookup, deleteO(1) average
Binary search treeinsert, search, traverseO(log n) if balanced