Learning Outcomes
You will learn to:
Describe the decomposition of a problem
Describe what an algorithm is
Describe Psuedocode
Describe flowchart and flowchart shapes
Write a simple algorithm to calculate the area of a circle.
Resource
One of the best resources is the teach-ICT.com site. Please use
the following link:
http://www.teach-ict.com/gcse_computing/ocr/216_programming/algorithms/miniweb
Definition
An
algorithm is simply a set of instructions for performing a task. Some
algorithms are more efficient than others and we will look at these in more
detail later in the course. The purpose of an algorithm is to find a
solution to a problem of to complete a goal in the most efficient and effective
way possible. A program is a set of instructions which have been written
in a lNguage the computer understands in order to make the algorithm work.
Decomposition
The reason for introducing this topic now is that in order to program
well you are going to need to think like a computer - particularly when you do
your controlled assessment. You need to decompose or break tasks down
into small chunks so that they are easy to follow and impossible to get wrong.
Penalty Kick Algorithm
Look at the following algorithm for taking a penalty kick. Try to
work out what is wrong with it. Remember the objective of a penalty kick
is obviously to score a goal.
1. Start
2. Place football on penalty spot
3. Kick ball
4. End
TASK 1
In pairs write an algorithm for taking a penalty kick which will result
in a goal being scored.
Lift Algorithm
Look at the following algorithm and work out why this one achieves all
it's objectives efficiently and effectively:
1. Start
2. Wait until doors are closed
3. Wait until the floor button is pressed
If button pressed is > than current floor
Move lift upwards
If button pressed is < than current floor
Move lift downwards
4. When current floor = button pressed
5. Open doors
6. End
TASK 2
Write an algorithm to calculate the area of a circle.
Flowcharts
Now let's explore the teach-ICT.com pages on Flowcharts
http://www.teach-ict.com/gcse_computing/ocr/216_programming/algorithms/miniweb/pg7.htm
Homework
Select
either your algorithm for calculating the area of a circle or the lift
operation algorithm in recreate as a flowchart.
No comments:
Post a Comment