Understanding the Basic Algorithms that Power Your Digital Life

Understanding the Basic Algorithms that Power Your Digital Life
Last Updated: March 26, 2016 12:51 am

This is Part 2 of a series on algorithms. Part 1, How to Explain Algorithms to Kids, is available here.

Understanding the Basic Algorithms that Power Your Digital Life

Algorithms provide a series of instructions that the computer follows to arrive at an answer and they underlie all of our technology. The problem that the algorithm is solving might be sorting a list, compressing a file, or determining which Internet pages are most relevant to you when you search for something. Algorithms determine how traffic signals are scheduled, how postal services can most efficiently deliver your mail, and much more.

In the digital age, kids should do more than just use technology. They need to explore the algorithms that power their phones, their social media sites, and their worlds so they can become fluent in coding, the language of technology, and take an active role in the creation of technology.

Search and Recommendation Algorithms

When you type a search into Google, it uses a very sophisticated algorithm that determines which pages on the internet are relevant to your search and ranks them based on how relevant and reputable they are. At its core, the PageRank algorithm takes into account how many other sites link to a given web page as well as the rank of the linking sites in order to determine the rank of that page. And it returns your results in less than a second!

The algorithm that recommends connections on social media (like the “People You May Know” recommendations on Facebook or Linkedin) works by calculating your degrees of separation from other users. If you are friends with Amy and Amy is friends with Ben, Facebook assumes that you might know Ben as well and recommends him as a potential connection. But if Amy is friends with Ben and Ben is friends with Charlene and Charlene is friends with Daryl and Daryl is friends with Erin, Facebook is unlikely to recommend Erin as a connection. In fact, scientists have theorized that, because of how globally connected we all are, there are only six degrees of separation between any two people on earth!

And when you use Amazon or Netflix, they recommend purchases or other shows you might be interested in based on a collaborative filtering algorithm that tries to predict what users will like based on the choices of other users with similar taste profiles.

Sort Algorithms

You may not think about it when you are sorting things in real life, but you are following an algorithm! Computers need to sort lists with millions of values extremely quickly, so sorting algorithms are very important.

Can you describe how you might sort ten books into alphabetical order? If you had to tell someone who didn’t understand the process of sorting how to sort the books, what steps would you write out?

You might start with one book, then add one book at a time, placing it in the proper place in your lineup. But imagine how many hours or years this would take if you had to do this with hundreds, thousands, or even millions of books! This algorithm is called Insertion Sort, and it works fine for small lists, but takes a lot of time for longer lists.

Another way you could sort the ten books would be to arrange them in a random order, then go down the list comparing books that are next to each other. First you would compare the first and second books. If they are in the wrong order, you swap them. Then you compare the second and third books, and again decide whether to swap them. Whenever you reach the end of the list, you go back through the list again, each time only comparing books that are immediately next to each other. This is called the Bubble Sort Algorithm, and it is again reasonable for small lists, but very inefficient for longer lists.

This project shows one way to implement a Bubble sort, with items in the list swapping to sort themselves:

Explore This Algorithm

Algorithms in Your Life

Efficient algorithms for searching and sorting are crucial for building software that runs quickly. These and other basic algorithms underlie most of your technology, from the YouTube video you stream to your phone, to the face detection on your camera.

How does YouTube stream to your phone so fast and seamlessly? How does your camera search for faces, all of which look very different depending on the person, the lighting, and the distance?

It might seem like your computer is making the kind of intelligent decisions that we normally think of as uniquely human, like making connections and educated guesses. But each of these is powered by a very complex algorithm that determines how to best accomplish the task using probability and logic.

If your child can understand and write algorithms, this opens up a whole world of possibility. It allows them to not only use these algorithms more effectively, but also to start writing their own programs and algorithms and solve meaningful problems with code.

Explore Programming Courses

About Tynker

Tynker enables children to learn computer programming in a fun and imaginative way. More than 60 million kids worldwide have started learning to code using Tynker.