- Audrey So

# Algorithms and Ideas for How to Introduce Them to Students

Have you ever followed a recipe or washed your hands? Perhaps you followed directions to get somewhere or even learned "The Floss Dance" from Fortnite? If so, you like millions of other people around the world have used algorithms to complete every day tasks.

**What is an algorithm? **

Simply, an algorithm is just a fancy sounding word for a **step-by-step** list of instructions. You can write an algorithm to cook spaghetti or to create a feature on a website. Algorithms can range from **very simple** **to extremely complex**. People everywhere use algorithms all the time to get things done.

**Why are algorithms important for Computer Science?**

A huge part of learning to code is understanding how to read and write algorithms. In order for a **computer** to understand a problem and solve it, humans need to **provide an algorithm**. These step-by-step procedures need to be **clear and specific** since computers have a limited vocabulary and do not understand English.

Algorithms are truly **at the heart** of Computer Science. Kids need to learn how to read and write algorithms so they can understand **how their code works**. For instance, if students are programming on Scratch, they might need to create an algorithm to make a character move five steps or perhaps spin in a circle. Once kids have a solid grasp on algorithms, they can also learn how to **improve their algorithms** to be more optimal.

**Where to begin**

There are lots of ways you can introduce students to algorithms! Here are two simple ideas to help you get started. You can easily modify these activities as needed to work for your class.

**Peanut Butter, Jelly Time**

This is one of my favorite activities used to introduce algorithms. My professor did this fun PB&J activity with us in a college level course, but it works with **any age** level!

__Materials__

*Plates**Paper towels**Peanut butter (If peanut allergies are an issue, you can do it without the peanut butter).**Jelly**Utensils (Knife and spoon)**Bread (at least 2 pieces)*

**1.** Gather all utensils and ingredients necessary to make a peanut butter and jelly sandwich.

**2.** Don’t show students your materials until after they've written their algorithms.

**3.** Individually or in teams,** **have students quickly write an algorithm for how to make a peanut butter and jelly sandwich.

**4. **Reveal your materials.

**5.** Select one of the student algorithms and follow it exactly, just like a computer would!

When doing this PB&J activity, you’ll definitely get a few laughs. Students will soon realize that they forgot to **include important details** or excluded information they thought was obvious. My students forgot to tell me to use a spoon or knife in their algorithms so I ended up using my hand to scoop out peanut butter! This PB&J activity can help students see how **specific algorithms need to be** and that **computers will carry out algorithms exactly **as they are written.

**Quick Draw**

Here’s a quicker and less messy activity.

__Materials__

Marker

Whiteboard (or something to write on so the whole class can see)

**Part 1**

**1. **Independently or in teams, have students to write an algorithm for how to draw a square.

**2.** Select one of the algorithms and follow it exactly!

Check out how one of my student's algorithms turned out after I followed her instructions. Looks like she needed to go back and modify her algorithm!

**Part 2 (Bonus)**

You can give students a turn to draw.

__Materials__

Markers

Whiteboards

Mystery images (Gather a few pictures of different objects. The objects could be anything - a rectangle, a lamp, or a mug.)

**1.** Pair students and give each duo a marker and a whiteboard. One student will draw (**the artist**) and the other student (**the speaker**) will give directions.

**2. **Tell the artists to cover their eyes. Show **only **the speakers the mystery image.

**3.**Have students sit back to back with their partner. ** **Partners should not look at each other. The artist cannot talk. Only the speaker can talk.

**4. **The speaker should describe how to draw that mystery image to their partner. The artist listens to their partner and draws that image based on the speaker's description.

**5.** After one minute, stop students and let them see the finished drawing.

**6.** Reveal the mystery image to all students.

**7. **Give students time to discuss their strategies.

**8.** Swap roles so each student has a chance to draw and give directions. Use a new mystery image each time.

This activity is quick, fun, and will warm students up to how algorithms work. Students can see that simple directions, such as how to draw a square, need to be **specific and clear**, especially for a computer to follow. It will also give students a chance to see things from another's **perspective** and practice teamwork and communication skills.

**Other Considerations**

Algorithms are very **powerful** and are the driving forces behind the wonderful technology we use every day. There are some downsides though. Today, there are lots of discussions about how algorithms can be **unintentionally bias** against certain groups of people.

Try searching online for images of a person, a scientist, a teacher, or a man. What do you see? What don’t you see? What assumptions does this algorithm make about gender, age, or race? Consider how **many people **search and view these images.

Talking about bias in algorithms could be a conversation worth having with your students. It could spark deeper discussions about the **power and influence algorithms can have** over millions of people.

**Final Thoughts**

If you're programming in the classroom, it's essential to teach your students about algorithms. However you choose to introduce this topic, show your students how fun it can be to **create** **and problem solve** using algorithms. Just check out (computer scientist) __Katie Bouman's algorithm__ if you don't believe me! At the end of the day we want to **empower students**, our future software developers and scientists of the **21st century**, to write great algorithms and think about the impact they could have.

Happy innovating!