« Back to Main Page

Beginner Algorithms

From Bold Idea Knowledgebase

Introduction

An algorithm is a list of steps you follow to finish a task. For example, a recipe for how to make pizza in an algorithm:

1. Spread the dough in the pan

2. Cover the dough in a layer of pizza sauce

3. Sprinkle cheese on top of the sauce

4. Bake the pizza for 20 minutes at 350 degrees Fahrenheit.

5. Take the pizza out of the oven and let it cool

6. Dig in!

You may not have realized it before, but you use algorithms like this one all day every day – from making a peanut butter and jelly sandwich to solving math problems at school. Computers need algorithms and programs to show them how to do even the simplest things that we can do without thinking about them. Try these activities with your team to practice writing detailed algorithms for everyday tasks and to create programs that the computer can follow.

What is it?

Coding, or Programming, is simply the way people tell a computer what to do using instructions that the computer understands.

Computer science is the study of computers and the processes that use algorithms – including their principles, their hardware and software designs, and their impact on society.

What is the difference between an algorithm and a program?

An algorithm is the thinking behind what needs to happen, while the program is the actual instructions that make it happen. An algorithm has to be translated into a program before a computer can run it.

Activities

My Morning Algorithm

In this activity, you’re going to write your own algorithm for something you do every day – your morning routine! Make a list of the things you do in the morning to get ready for school – from waking up to leaving for school. You may want to write each action as numbered steps in a sequential order. Share your morning algorithm with your team. Did you notice anything that you all did the same or different? Are there places where the order of your routine matters and places where it doesn’t? Brainstorm with your team other examples of algorithms that you do each day.

Maze Sequence

Are you familiar with the game Angry Birds? In the Maze Sequence puzzle on Code.org, you’ll write programs to help an Angry Bird locate a pig. Getting the bird to the pig will require putting your directions in a very specific order or sequence. Try solving these puzzles using the fewest blocks possible.

Artist Sequence

In the Artist Sequence puzzle, you will be moving a character who leaves a line everywhere it goes. And here’s a handy reference to help you with the angles that your character will need to make:

ArtistSequence Algorithms.png

Marching Orders

Do you think it would be good if people followed instructions exactly? For example, what would happen if you pointed to a closed door and said, “Go through that door”? Computers work by following lists of instructions, and they do exactly what the instructions say – even if they don’t make sense! So, coders must be good at specifying exactly what they want the computer to do.

Draw It!

In pairs, take turns drawing very simple pictures, like a smiley face, without the other person seeing. Then, describe to the other person how to re-create your drawing, without them asking you any questions. Were they able to follow your instructions?

This form of communication is most like the one that coders experience when writing programs. They give a set of instructions to the computer and don’t find out the effect of the instructions until afterwards.

Move It!

Now, take turns giving verbal instructions for how to get to a location inside the classroom using specific commands. Here are some commands:

  • Step forward _______ steps (specify how many steps)
  • Step backward _______ steps (specify how many steps)
  • Turn left 90 degrees
  • Turn right 90 degrees
  • Turn 180 degrees (turn around to face the other way)

Then, try the game again this time using written instructions instead of verbally giving commands. In both Draw It! And Move It!, who do you suppose was more like the coder, and who was more like a computer?