Problem Solving - 1.1 Algorithms Flashcards
What is an Unambiguous?
An instruction that cannot be misunderstood. Saying ‘turn’ will be an ambiguous instruction because you can turn left or right, while saying ‘turn left’ will be an Unambiguous instruction.
What is a Sequence?
An ordered set of instructions.
What is an algorithm?
A precise method for solving a problem. It is unambiguous, and can be made up of a sequence of steps.
How can algorithm be ‘successful’?
It has to be accurate - it must lead to the expected outcome (e.g. get an accurate route from Dubai Mall to Abu Dhabi airport.
It has to be Consistent - it must produce the same result each time it is run.
It has to be efficient - it must solve the problem in the shortest possible using as few computer resources as possible. E.g. Finds the shortest route possible from Dubai Mall to Abu Dhabi airport,
What is ‘High-level programming language’?
A programming language that resembles natural human language.
An example of a written description of an algorithm for making a cup of instant coffee is….
Fill kettle with water. Turn on kettle. Place coffee in cup. Wait for water to reach 100 degrees. Pour Water into cup. Add milk and sugar. Stir.
What is a flow chart?
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.
What does the oval in a flowchart represent?
Indicates the start or end of an algorithm.
What does the rectangle in a flowchart represent?
Indicates a process to be carried out.
What does the triangle in a flowchart represent?
Indicates a decision to be made.
What does the parallelogram in a flowchart represent?
Indicates an input or an output.
What does the arrow in a flowchart represent?
Shows the logical flow of an algorithm.
What is pseudo-code?
In addition to flowcharts and written descriptions, algorithms can also be expressed in pseudo-code. Pseudo-code is a structured, code-like language that can be used to describe an algorithm.
An example of pseudo-code is…..
SEND ‘Please enter the first number.’ TO DISPLAY
RECIEVE firstnumber FROM KEYBOARD
SEND ‘Please enter the second number.’ TO DISPLAY
RECIEVE secondnumber FROM KEYBOARD
SET total TO firstnumber + secondnumber
SEND total TO DISPLAY
What is a Variable?
a ‘container’ used to store data. The stored data 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.
What is an identifier?
A unique name given to a variable or a constant. Using descriptive names for variables makes code much easier to read.
What is an Arithmetic Operator?
An operator that performs a calculation on two numbers.
What does this Arithmetic Operator do: + ?
Addition : Adds values together. E.G. 8+5 = 13, myscore1 + myscore2.
What does this Arithmetic Operator do: - ?
Subtraction: subtracts the second value from the first. 17 - 4 = 13, e.g. myscore1 - myscore2