AS Computing
Unit 1.9 – Algorithms
What is an Algorithm?
An algorithm is a finite set of instructions to solve a problem. These instructions must be able to be
processed by a computer. They can be represented in pseudocode or flowcharts.
What Are Three Possible Algorithm Structures?
1. Sequence
a. A set of instructions that are executed one after another.
b. They are used when you want things to happen in a certain order.
c. An example of this is logging on to a school network.
d. Examples:
i. Making a cup of tea.
ii. Baking a cake.
iii. Getting dressed for school.
2. Selection
a. A set of choices from which one can be chosen.
b. They are used when you want your solution to make a decision.
c. An example of this is deciding whether to put a coat on depending on whether it is
cold outside.
d. Essentially If, Then, Else statements.
3. Iteration
a. An algorithm that will run until a condition is met or a result is achieved.
b. They are used when you want something done and it will take more than one
process.
c. May be repeated a fixed number of times or even a variable number.
d. An example of this is washing your car until the car is clean.
e. Essentially, Loops.
What is Dry-Running an Algorithm?
It is when you read an algorithm and work out what it does and what it is supposed to do. A dry run
does not involve coding or a computer.
Why Are Self-Documenting Variables and Identifiers Important?
1. If the development stage takes a long time they are useful to remind the developer what
they do.
2. Useful for other programmers who have to perform maintenance on the code so that they
can understand what the program does and how to fix it.
3. It is good practice and companies often have house styles/policies requiring employees to
adopt certain coding styles.
Page |1 Luca Passariello AS Computing
Unit 1.9 – Algorithms
What is an Algorithm?
An algorithm is a finite set of instructions to solve a problem. These instructions must be able to be
processed by a computer. They can be represented in pseudocode or flowcharts.
What Are Three Possible Algorithm Structures?
1. Sequence
a. A set of instructions that are executed one after another.
b. They are used when you want things to happen in a certain order.
c. An example of this is logging on to a school network.
d. Examples:
i. Making a cup of tea.
ii. Baking a cake.
iii. Getting dressed for school.
2. Selection
a. A set of choices from which one can be chosen.
b. They are used when you want your solution to make a decision.
c. An example of this is deciding whether to put a coat on depending on whether it is
cold outside.
d. Essentially If, Then, Else statements.
3. Iteration
a. An algorithm that will run until a condition is met or a result is achieved.
b. They are used when you want something done and it will take more than one
process.
c. May be repeated a fixed number of times or even a variable number.
d. An example of this is washing your car until the car is clean.
e. Essentially, Loops.
What is Dry-Running an Algorithm?
It is when you read an algorithm and work out what it does and what it is supposed to do. A dry run
does not involve coding or a computer.
Why Are Self-Documenting Variables and Identifiers Important?
1. If the development stage takes a long time they are useful to remind the developer what
they do.
2. Useful for other programmers who have to perform maintenance on the code so that they
can understand what the program does and how to fix it.
3. It is good practice and companies often have house styles/policies requiring employees to
adopt certain coding styles.
Page |1 Luca Passariello AS Computing