Algorithm
Algorithm
a way of planning the structure and function of a program in a short, clear and
precise way.
It is also important to emphasise that there is no defined pseudocode that everyone uses.
The pseudocode that is written and used will differ depending upon an individual’s purpose
and experience.
value1 = INPUT
value2 = INPUT
result = value1 + value2
print(result)
value1 ← ReadLineFromUser
value2 ← ReadLineFromUser
Printout value1 + value2
What is pseudocode?
Answer: A form of representing an algorithm without a set syntax.
When is pseudocode used?
Answer: When planning or designing algorithms.
Why is pseudocode used?
Answer: It is language independent so anyone should be able to understand it.
What features does pseudocode contain?
Answer: Command words, assignment symbols, mathematical symbols.
What is selection?
Elicit that selection is an instruction within an algorithm where a decision is made about
whether to run a piece of code or not. Then ask:
How is selection usually written in programming?
Elicit that it is usually written as a question, or a comparison, that results in ‘true’ or ‘false’.
Ask:
What are the key words used in conditional statements in programming?
Answer: IF, THEN, ELSE
What are the different symbols that can be used for comparisons?
Answer: >, <, >=, <=, <> =
IF statement-
if condition:
Code to run if true
else:
Code to run if false
What is decomposition?
Answer: Splitting a problem into smaller problems.
How does decomposition help you solve a problem?
Answer: Smaller problems are easier to solve and then join together.
How does decomposition help a team build a program?
Answer: Tasks can be split between individual team members.