10n2
Starter:
Exam Marks..
Q4
Main:
Algorithms
BBC Bitesize
"An algorithm is a set of instructions that describes how to get something done. Algorithms can be designed using pseudocode and flow charts. They are written using statements and expressions"
Algorithms are sets of step-by-step instructions that if followed exactly will perform a specific task.
Flowcharts
Tea Algorithm?
Pass the Parcel?
Anything else?
Pseudocode
Common pseudocode notation
There is no strict set of standard notations for pseudocode,
but some of the most widely recognised are:
INPUT – indicates a user will be inputting something
OUTPUT – indicates that an output will appear on the screen
WHILE – a loop (iteration that has a condition at the
beginning)
FOR – a counting loop (iteration)
REPEAT – UNTIL – a loop (iteration) that has a condition at
the end
IF – THEN – ELSE – a decision (selection) in which a choice
is made
Any instructions that occur inside a selection or iteration
are usually indented
Pseudocode can be used to plan out programs. Planning a
program that asks people what the best subject they take is, would look like
this in pseudocode:
REPEAT
OUTPUT
'What is the best subject you take?'
INPUT
user inputs the best subject they take
STORE the
user's input in the answer variable
IF answer
= 'Computer Science' THEN
OUTPUT
'Of course it is!'
ELSE
OUTPUT
'Try again!'
UNTIL answer = 'Computer Science'
Challenge: Try the tasks on the sheets
Plenary:
Q10/11/12
Comments
Post a Comment