Al Noor International School
Cambridge International AS Level Computer Science 9618
Paper 2 Fundamentals Problem-solving and Programming Skills
Notes
Contents
Chapter 9: Algorithm design and problem solving ............................................................................................ 2
9.1 Computational Thinking Skills ................................................................................................................. 2
9.1.1 Abstraction ....................................................................................................................................... 2
9.1.2 Decomposition.................................................................................................................................. 2
9.1.3 Pattern Recognition .......................................................................................................................... 2
9.1.4 Stepwise Refinement........................................................................................................................ 2
9.2 Algorithms ............................................................................................................................................... 2
9.2.1 Definition .......................................................................................................................................... 2
9.2.2 Methods Used to Write Algorithms before Programming a Solution .............................................. 2
9.2.3 Common Flowchart Symbols ............................................................................................................ 3
9.2.4 Three Types of Activities in Algorithms ............................................................................................ 3
9.2.5 Three Basic Constructs of Algorithms............................................................................................... 4
9.3 Identifier .................................................................................................................................................. 4
9.3.1 Rules for Naming Identifiers in Pseudocode .................................................................................... 4
9.3.2 Effects of Using Non-Meaningful Identifier Names in Pseudocode ................................................. 4
9.3.3 Identifier Table ................................................................................................................................. 4
2
Chapter 9: Algorithm design and problem solving
9.1 Computational Thinking Skills
Computational thinking involves analyzing a problem and developing an efficient solution that can be
implemented using a computer. This process relies on several key techniques, including abstraction,
decomposition, algorithms, and pattern recognition.
9.1.1 Abstraction
Abstraction is the process of filtering out information that is not necessary to solve the problem, focusing
only on the essential information.
Benefits:
• Simplifies the solution, making it easier and faster to design and implement.
• Ensures the system is focused and tailored to meet the user's needs.
• The program is smaller in size so takes up less space in memory and download times are shortened
Stages of Abstraction:
• Identify the purpose of the model of the situation that is to be built.
• Identify sources of information; includes observations, views of potential users, and evidence from other
existing models
• Use information gathered from appropriate sources to identify what details need to be included in the
model, how these details should be presented and what details to be removed from existing models.
9.1.2 Decomposition
The process involves
• Breaking down a problem or task into smaller sub-problems, steps, or components.
• This makes it easier to explain, understand, and solve the problem.
• It leads to the concept of program modules and allows different parts to be assigned to teams.
Benefits:
• Breaking down a complex problem makes it simpler to understand and solve.
• Smaller problems are easier to work with, program, test, and maintain.
• Sub-problems can be assigned to different teams or programmers with specific expertise, allowing them
to be solved independently.
9.1.3 Pattern Recognition
Pattern recognition involves identifying similar parts of a problem that can be solved in the same way. This
allows for the creation of reusable code through subroutines, procedures, and functions.
9.1.4 Stepwise Refinement
• Breaking down a problem into smaller parts.
• Each part is refined to a sufficient level of detail.
• The resulting sub-tasks are easier to understand and program.
9.2 Algorithms
9.2.1 Definition
• An algorithm is a sequence of steps or instructions.
• It is used to carry out a task or solve a problem.
9.2.2 Methods Used to Write Algorithms before Programming a Solution
The three commonly used methods to write algorithms before developing a program are:
Computer Science 9618 Chapter 9
Paper2 Fundamentals Problem-solving and Programming Skills
3
• Structured English – This method uses a simplified form of English with a limited set of clear,
agreed-upon commands and mathematical terms to outline the logical steps of the algorithm. These
steps are often numbered to show sequence.
• Flowcharts – Flowcharts use standard symbols connected by arrows to visually represent the sequence
of operations in an algorithm. They help illustrate the structure and flow of a task clearly and are effective
for understanding the overall process.
• Pseudocode – Pseudocode presents the detailed logical steps of an algorithm using a format that
resembles programming but does not adhere to any specific language syntax. It includes keywords,
meaningful variable names, and operators, making it easy to convert into actual code later.
Eg:- Algorithm to find the sum of two integers in Structured English, Flowchart & Pseudocode
Structured English Flowchart Pseudocode
• Accept Number1 Start DECLARE Number1,Number2,Sum: INTEGER
• Accept Number2 INPUT Number1
• Find the sum by INPUT Number2
adding Number1 and
INPUT Number1
Sum Number1 + Number2
Number1
OUTPUT Sum
Number2.
INPUT Number2
• Display the Sum Number1
Set Sum to Number1 + Number2
OUTPUT Sum
End
9.2.3 Common Flowchart Symbols
Flowchart Symbol Description
Start or End of a process
A task or action (Process)
Eg:- Assignment using a calculation
A decision point (Decision)
Eg:- IF or CASE
Part of FOR, REPEAT and WHILE
INPUT or OUTPUT
A subroutine
Direction of flow between steps
9.2.4 Three Types of Activities in Algorithms
Algorithms typically involve three main types of activities:
1. INPUT
This is where data is received or entered into the system.
2. PROCESS
This involves manipulating or calculating data.
3. OUTPUT
This is where results or messages are displayed.
Computer Science 9618 Chapter 9
Paper2 Fundamentals Problem-solving and Programming Skills
4
INPUT PROCESS OUTPUT
Example: Examples: Examples:
INPUT StuName Percentage ←(StuMark/80)*100 OUTPUT StuName
Counter ← Counter + 1 OUTPUT "Student name
MyChar ← 'A' is ", StuName
LetterValue ← ASC(MyChar)
StuMark ← 40
9.2.5 Three Basic Constructs of Algorithms
Algorithms are built using three fundamental constructs:
1. SEQUENCE
Executes instructions one after another in order.
2. SELECTION
Chooses between different actions based on a condition.
Uses structures like IF...THEN...ELSE OR CASE.
3. ITERATION (Repetition)
Repeats a block of code until a condition is met.
SEQUENCE SELECTION ITERATION
Example: Example: Example:
INPUT StudentName IF MyValue>Value THEN REPEAT
Counter ← Counter+1 OUTPUT "I win" OUTPUT "Enter a positive
MyChar ← 'A' ELSE number"
LetterValue ← ASC(MyChar) OUTPUT "You win" INPUT Number
StudentMark ← 40 ENDIF UNTIL Number > 0
9.3 Identifier
A unique name applied to the item of data.
9.3.1 Rules for Naming Identifiers in Pseudocode
• Identifiers must be meaningful.
• They should only contain letters (A–Z, a–z), digits (0–9)and the underscore character ( _ ).
• They must start with a letter not a digit.
9.3.2 Effects of Using Non-Meaningful Identifier Names in Pseudocode
• Increases risk of using incorrect names in the code.
• Makes the program harder to understand, especially for others or when revisiting later.
• Complicates debugging, testing, and making changes to the program.
9.3.3 Identifier Table
A suitable way of documenting variables is by using an identifier table.
An identifier table contains:
• A list of identifier or variable names
• Explanations or descriptions of what each identifier is used for
• The data type of each identifier (e.g., integer, string, boolean)
Computer Science 9618 Chapter 9
Paper2 Fundamentals Problem-solving and Programming Skills