How to Write Simple Algorithms

By Brad Malloy

Algorithms surround us every day, from simple ones that drive traffic lights to the more complex instructions for home security systems. An algorithm is a set of instructions that governs how something works. One of the first lessons in many computer science courses is creating an algorithm that will make a peanut butter and jelly sandwich; what is usually a simple task is actually quite complex when broken down. Algorithms are the basis for pseudocode, and they can help to simplify complex tasks by organizing them into smaller, simpler steps.

Things You'll Need

  • Text editor

Step 1

Define the goal of your algorithm. If you can't think of your own, use "make a peanut butter and jelly sandwich" as an example.

Step 2

Write each step needed to complete the procedure in plain English, with each step on a separate line.

Step 3

Break down each step. If there are any concepts that require previous knowledge, explain them in terms that someone with no prior experience could understand. A good algorithm is clear without being overly verbose.

Tips & Warnings

  • Try introducing your steps to a friend or relative to gain some insight into what is unclear.