Find a course

Module 1: What Is an Algorithm?Lesson 1 of 78 min

Algorithms Are Everywhere

A recipe, a dance and your morning routine are all algorithms. Learn what an algorithm is and why computers need such clear, exact steps.

Step 1 of 12Learn

A list of steps

This morning you probably got up, brushed your teeth, got dressed and ate breakfast. Did you know you were following an algorithm?

An algorithm is a list of steps that gets a job done. A recipe for pancakes is an algorithm. The rules for a game of tag are an algorithm. So are the directions to your school.

Computers use algorithms for everything: showing a video, adding up your game score, finding the fastest way home. The word sounds fancy, but the idea is simple: do this, then this, then this.

Step 2 of 12Practice · Choose one

Which of these is an algorithm?

Step 3 of 12Learn

Computers are very literal

Here is the tricky part. People are good at guessing what you mean. Computers are not. A computer does exactly what the instructions say, nothing more and nothing less.

If you tell a friend "make a sandwich," they know what to do. A robot would just stand there. Which bread? Where is the knife? How do you open the jar?

That is why a good algorithm is clear (no guessing), exact (every step spelled out) and in the right order.

Step 4 of 12Practice · True or false

A computer will guess what you meant if your instructions are a little unclear.

Step 5 of 12Tap to reveal

Three things every good algorithm needs

  1. Clear steps

    Each step means only one thing. "Add some sugar" is unclear. "Add 2 spoons of sugar" is clear.

  2. The right order

    Steps happen one after another. Putting on shoes before socks does not work!

  3. An end

    A good algorithm finishes. When the job is done, it stops.

Step 6 of 12Practice · Select all that apply

Which of these are algorithms? Pick all that are right.

Select all that apply.

Step 7 of 12Flashcards

Algorithms you already know

Tap a card to flip it.

Step 8 of 12Learn

Input and output

Many algorithms take something in and give something back.

What goes in is the input. What comes out is the output.

Think of a pancake recipe. The inputs are flour, eggs and milk. The output is a stack of pancakes. A calculator works the same way: you type 3 + 4 (input) and it shows 7 (output).

Step 9 of 12Practice · Sort into groups

Sort these into inputs and outputs for making a smoothie.

Tap an item, then tap its group (or drag it there).

Step 10 of 12Practice · Diagram

Input, algorithm, output

A calculator shows 7 after you type 3 + 4. Tap where the 7 belongs.

Tap the shape that answers the question, then press Check.

Input, algorithm, outputProcess diagram: Input → Algorithm → Output.InputAlgorithmOutput
Input

What goes in: bananas, milk, strawberries.

Algorithm

The steps: put fruit in, pour milk, blend 30 seconds.

Output

What comes out: a smoothie!

Step 11 of 12Note

Step 12 of 12Practice · Fill in the blanks

Fill in the blanks

A list of steps that gets a job done is called an .

Word bank