Algorithms

An algorithm is a set of steps or rules used to solve a problem.

An algorithm is a system of logic used to carry out a task in a repeatable manner.

Those are my attempts to define an algorithm. Here are several other explanations:

Khan Academy – What is an algorithm and why should you care?

Crash Course Computer Science – Intro to Algorithms

Slate.comĀ  – What is an Algorithm?

Example Algorithm #1: How to wash your hands

  1. Put soap on your hands
  2. Start the water
  3. Put hands under the water
  4. Scrub hands together until bubbles form
  5. Put hands under water and scrub until the bubbles are rinsed off
  6. Turn water off
  7. Use a towel to dry off the water from hands

Example Algorithm #2: Diagnose a car that won’t start

If starter makes a clicking sound: starter doesn’t work or the battery might be totally dead

If engine makes a groaning sound, the engine might be too cold or the battery might not have enough charge

If the engine is turning but not starting and it smells like gasoline, the engine is probably flooded.

Algorithms vs Programming

Creating an algorithm means defining a set of logical rules or steps. This can be done without putting those rules into a programming language.

The rules could be in English (like the examples above) or written down graphically (e.g. flowchart)

You need to figure out the purpose for an algorithm and then define how it’s going to work before you can start programming.

Programming means creating code that does something, and that skill includes things like knowing the language rules, troubleshooting, collaborating with others, managing files, finding helpful resources, and so on.