What is an algorithm?
An algorithm is a sequence of logical instructions for carrying out a specific task / or solve a specific problem. Everything a computer does is the implementation of an algorithm - programs are simply computer code written to allow algorithms to be carried out.
This approach to solving a problem using algorithms is called Computational Thinking. There are three stages
1) Decomposition - splitting the big problem down into all of its smaller sub problems
2) Abstraction - removing all non essential information and focusing just on the core of each problem
3) Algorithmic Thinking - Iworking out the steps you need to take to solve the problem and the order you need to take those steps in
The problem or task can be anything, and algorithms don't have to be carried out by a computer.
For example we could create an algorithm for cleaning a pair of football / hockey boots:
- Take boots of your feet
- Knock off the worst of the mud and grass
- Remove laces
- Fill a bucket or bowl with water and get a sponge or cloth
- Use the water and cloth / sponge to clean off any remaining dirt
- Let the boots dry
- Whilst boots drying wash the laces
- Get polish and cloth and boot brush
- Rub polish onto boots using cloth
- Use the boot brush to "buff" the boots, making the polish shine
- Once laces dry, re lace boots
Each step is important and if you miss one, or do them in the wrong order you end up with strange results - imagine adding polish before knocking off the mud... messy...
Algorithms can be written as a series of steps in plain english (as I've done above) or they can be written as a flowchart. If this was an algorithm for a computer you would then write the algorithm in pseudocode to help plan it out.