You Got ‘Rithm

US Department of Education on Flickr

What makes a good algorithm? Let's find out!

You might already know that an algorithm is a series of steps that solve a problem, for example, how to get dressed in the morning. First you have to find where you keep your clothes, then pick out what to wear, then get dressed for the day.

Algorithms are a critical part of computing. They’re more defined than how to get dressed but they are similar:

  • In computing, the steps in an algorithm are clearly defined and thus repeatable.
  • Each operation within a step effectively solves the problem
  • And the steps are finite. They don’t continue forever once the problem is solved.

Most programmers would add that a good algorithm also produces the same correct result every time it is used. And correct doesn’t mean precise: sometimes an estimated solution is good enough.

Programmers spend a lot of time creating and using algorithms as they code. Their experience with algorithms is more complicated than a simple definition.

For example, not all algorithms that solve a problem are equally good. Some algorithms work best for one kind of problem but not another. And algorithms use data structures which also have their good and bad points. Analyzing algorithms becomes an important skill to learn.

You might think the most obvious way to analyze algorithms is to compare how fast they run through their steps to solve a problem. However, computers have different configurations. What runs fast on one computer runs slow on another. Programming languages also affect speed: an algorithm coded in C will almost always run faster than when coded in Python. Because of these factors, comparing the run time of two different algorithms is not an effective way to analyze algorithms.

Instead, perhaps the simplest way to analyze algorithms is to compare the number of steps an algorithm takes to complete its tasks and solve a problem.

The number of steps is measured as an order of magnitude, or big O notation. The simplest is an algorithm with a fixed number of steps regardless of the number of inputs or the steps within the algorithm. For example, if you only say hello to the first person you meet every day, that’s a constant time order of magnitude because you only say hello one time each day.

There are more complicated examples of order of magnitude. If you want to learn more, definitely look up The Self-Taught Computer Scientist by Cory Althoff. His book describes computer science concepts programmers use in their work, including how to analyze algorithms.

Learn More

Self-Taught Computer Scientist


Artificial Intelligence Algorithms

What is an Algorithm?

What is a Computer Algorithm

Real World Algorithm Examples

Algorithms for Kids

How to Explain Algorithms to Kids

Algorithm Facts for Kids

What is an Algorithm


Also In The February 2022 Issue

Meet the brilliant mathematician and pioneer of coding, Ada Lovelace!

Do you think your internet is slow? Wait till you learn about dial-up!

Time for a blast from the past as we look back at some most memorable technology from the early days of modern tech!

Interesting stories about computer science, software programming, and technology for February 2022.

Links from the bottom of all the February 2022 articles, collected in one place for you to print, share, or bookmark.

Receive an email announcement of new issues, sent every two months, plus a monthly newsletter with curated site content.

No, thanks!