How to Write Simple Algorithms
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
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.
Write each step needed to complete the procedure in plain English, with each step on a separate line.
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.