- a sequence of instructions, or
- a set of rules
to solve a problem or complete a task.
Where do we use algorithms?
Everywhere! Your task does not have to be a computer program, it could be solving a simple math problem, making a paper airplane or a recipe for tomato sauce. The sequence of instructions or rules need to be followed in order for your sum to be correct, your paper airplane to fly, or for your sauce to be edible.
In computer science, we use algorithms in the “problem solving phase”, basically the planning and strategy needed before you write a program.
Algorithms in Mathematics
Column addition is a simple, easy but foundational algorithm in Math.
Column addition involves:
- Recording numbers in place-value columns;
- Adding in place-value columns; and
- Making and moving groups of 1s, 10s, 100s.
Since we are taught this as a set of rules or instructions, in other words, an algorithm; we understand it easily and are able to remember and repeat it.
OK, how do I get started writing an algorithm?
In computer science, 2 different models or methods are used to write algorithms:
Pseudocode is writing an algorithm in any natural language, like English. It models and resembles real programming code, and is written at roughly the same level of detail, but is not specifically in any programming language. The advantage is it can then be translated into any programming language.
Visual Algorithm or Flow chart
Algorithms can be a set of numbered instructions (recipe for tomato sauce), a set of rules (column addition algorithm) to solve a problem, or a visual sketch or diagram that shows all the steps in a process or system. These visual algorithms are known as flowcharts (or flow charts) and are heavily used in many industries, including computer science.
If you’d like to learn more about flow charts, including common shapes and symbols used in flowcharts, and some great examples of flowcharts, click on the links below.
- STEAMism – Flowcharts – the what, why and how (common shapes and symbols used)
- STEAMism – Flowchart examples to get you started!
Coding an algorithm
Computers don’t understand visual flowcharts or pseudocode, the instructions have to be “coded” or rewritten using a programming language.