Algorithm Writing and Modification | 算法编写与修改

📚 Algorithm Writing and Modification | 算法编写与修改

In computer science, an algorithm is a set of step-by-step instructions that solves a problem. In the Cambridge IGCSE Computer Science syllabus, you are expected to write, analyse and modify algorithms using flowcharts and pseudocode.

在计算机科学中,算法是为解决问题而编写的一组逐步指令。在剑桥 IGCSE 计算机科学考纲中,你应能使用流程图和伪代码来编写、分析并修改算法。

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

An algorithm must be precise, unambiguous and finite. It must have a clear start and end, and each step must be simple enough to carry out without confusion.

算法必须精确、无歧义并且有限。它必须有明确的起点和终点,并且每一步都应足够简单,不会引起混乱。

  • Input: data given to the algorithm before it begins.

    输入:算法开始前提供给它的数据。

  • Processing: calculations and decisions performed on the data.

    处理:对数据执行的计算和判断。

  • Output: the results displayed to the user.

    输出:显示给用户的结果。

An algorithm can be written before any programming language is chosen. It describes the logic of a solution, not the exact syntax of a language.

算法可以在选择任何编程语言之前编写。它描述的是解决方案的逻辑,而不是某种语言的具体语法。


2. Flowcharts and Pseudocode | 流程图与伪代码

Flowcharts use standard symbols to show the order of steps in an algorithm. Pseudocode is a text-based way of describing the same logic using simple English-like statements.

流程图使用标准符号来显示算法步骤的顺序。伪代码是一种基于文本的描述方式,用接近英语的简单语句表示相同逻辑。

Flowchart Symbol Meaning 中文含义
Oval / rounded rectangle Start or end 开始或结束
Parallelogram Input or output 输入或输出
Rectangle Process / calculation 处理 / 计算
Diamond Decision with yes/no branches 判断,包含是/否分支
Arrow Flow of control 控制流向

In CIE-style pseudocode, assignment is written with the arrow symbol ←. For example, total ← total + 1 means ‘store the value of total + 1 into total’.

在 CIE 风格伪代码

Published by TutorHao | IGCSE Computer Science 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