Topic 1: Problem Solving Flashcards
What is an algorithm?
A set of instructions that perform a specific task
Or
A precise method for solving a problem
What is the purpose of algorithm?
To visualise the logical steps of a task
Key term:
Unambiguous
This means that the instructions cannot be misunderstood. Simply saying ‘turn’ would be ambiguous because you could turn left or right
Key term:
Sequence
An ordered set of instructions
Key term:
High-level programming language
A programming language that resembles natural human language
Key term:
Flowchart
A graphical representation of an algorithm.
Each step in the algorithm is represented by a symbol.
Symbols are linked together with arrows showing the order in which steps are executed
Written descriptions
The simplest way of expressing an algorithm. E.g an algorithm for making a cup of instant coffee: Fill kettle with water. Turn on kettle. Place coffee in cup. Wait for water to boil. Pour water into cup. Add milk and sugar. Stir.
Key term:
Pseudo-code
A structured, code-like language that can be used to describe an algorithm
Pseudo-code
Algorithm for adding two numbers
SEND ‘please enter the first number.’ TO DISPLAY
RECEIVE firstNumber FROM KEYBOARD
SEND ‘please enter the second number.’ TO DISPLAY
RECEIVE secondNumber FROM KEYBOARD
SET total TO firstNumber + secondNumber
SEND total TO DISPLAY
Key term:
Variable
A ‘container’ used to store data. The data stored in a variable is referred to as a value. The value stored in a variable is not fixed. The same variable can store different values during the course of a program and each time a program is run
Key term:
Identifier
A unique name given to a variable or a constant. Using descriptive names for variables makes code much easier to read
Key term:
Arithmetic operator
An operator that performs a calculation on two numbers
Arithmetic operator:
+
Addition: add the values together
Arithmetic operator:
-
Subtraction: subtract the second value from the first
Arithmetic operator:
*
Multiplication: multiply the values together