Designing an algorithm

An algorithm is a plan, a logical step-by-step process for solving a problem. Algorithms are normally written as a flowchart or in pseudocode.

The key to any problem-solving task is to guide your thought process. The most useful thing to do is keep asking ‘What if we did it this way?’ Exploring different ways of solving a problem can help to find the best way to solve it.

When designing an algorithm, consider if there is more than one way of solving the problem.

When designing an algorithm there are two main areas to look at:

  • the big picture - What is the final goal?
  • the individual stages – What hurdles need to be overcome on the way to the goal?

Understanding the problem

Before an algorithm can be designed, it is important to check that the problem is completely understood. There are a number of basic things to know in order to really understand the problem:

  • What are the inputs into the problem?
  • What will be the outputs of the problem?
  • In what order do instructions need to be carried out?
  • What decisions need to be made in the problem?
  • Are any areas of the problem repeated?

Once these basic things are understood, it is time to design the algorithm.