How Algorithms Work

You Can't Beat an Algorithm.

Summary: People find new information online three ways:

  1. Digital publications (usually via email notifications to subscribers)

  2. Social media feed posts (shared from within their filter bubble community)

  3. Search Engine feed (results pages) links

Unlike publications, which are curated by humans, both social feeds and search feeds are created by algorithms that maintain the user's filter bubble and leverage the power of AI to select for content that generates engagement, actions and ads.

Fun Pair Activity: Become the Algorithm

Nim is a simple counting game. There are many versions out there - this one is also called "21". There is a discoverable mathematical pattern which means the second player always wins (or any player wins once one makes an error). Our programming students code the game with a "Simple" and "Trainer" mode. In the "Simple" mode, the computer takes random turns; in "Trainer", it wins every time.

Playing this verbally, students figure out how to win. Once one has seen the pattern, they demonstrate it (and give hints) until the partner sees it. Social Media feeds are created by algorithms which, like Nim players who know the secret, will always win*. *Google Search is now hiding or deprecating some categories of disinformation, such as anti-vaccine propaganda. Users who want that content are switching to the Duck Duck Go search engine. If you want to find disinformation, use that.

Essential Question: How do Search Algorithms work?
: Video, Pair Share, Present
Learning Objectives: Students will:

  1. Optional: try random vs algorithmic play.

  2. Play the counting game Nim verbally (21)

  3. Read a flow chart to "train the algorithm"

  4. Experience algorithmic winning.

  5. Help a partner learn how to win.

Facebook's Filter Bubble

Facebook's newsfeed algorithm wants you engaged, so it shows you more of what you've already engaged with: what you've slowed scrolling for, what you've spent time looking at, videos you played, links you clicked, and especially people and posts who get your likes and follows and comments. The more engaged you are, the more ads you see that can be targeted to your filter bubble, and the more money Facebook makes.

The better that algorithm works, the more your universe shrinks around your existing interests, beliefs and tendencies. If you tend towards conspiracy theories - watch out!

What Algorithms do to you ...

How do you get out of your filter bubble? You could create a new account and click on the opposite of what you normally would, building a version of yourself in the 'Upside Down".

Now, probably you won't change your mind as a result ... but you might gain some more empathy for people who think differently than you do.

The Code of Algorithms

If you don't have any experience looking at code, this might not do much for you, but give it a try! It's from, where you can learn programming, web development, cyber security and many other topics - even Roblox - and it's free!

This demo activity allows you to experiment with visualizing different sorting algorithms. You'll see the Javascript code and a run box at right.

When you click run, the program will ask you to pick a number of items (like Tetris Boxes), choose a sorting algorithm (Selection or Insertion), and then show with random differently-sized boxes how that algorithm sorts.

All About the TikTok Algorithm - in case you wanted to trend there.

(excerpt from the NY Times)

There are four main goals for TikTok’s algorithm: 用户价值, 用户价值 (长期), 作者价值, and 平台价值, which the company translates as “user value,” “long-term user value,” “creator value,” and “platform value.” ....

“TikTok Algo 101” was produced by TikTok’s engineering team in Beijing. A company spokeswoman, Hilary McQuaide, confirmed its authenticity, and said it was written to explain to nontechnical employees how the algorithm works. ...

The document offers a rough equation for how videos are scored, in which a prediction driven by machine learning and actual user behavior are summed up for each of three bits of data: likes, comments and playtime, as well as an indication that the video has been played:

Plike X Vlike + Pcomment X Vcomment + Eplaytime X Vplaytime + Pplay X Vplay

(rxcerpt from Hootsuite blog)

How to work with the TikTok algorithm in 2022:

  1. Switch to a TikTok Pro account

  2. Find your subculture

  3. Maximize the first moments

  4. Write an engaging caption

  5. Create high-quality videos just for TikTok

  6. Post at the right time for your audience

  7. Engage with other TikTok users

  8. Use the right hashtags

  9. Use trending sounds and music

The following types of content will NOT be recommended by the algorithm:

  • Duplicated content

  • Content you’ve already seen

  • Content the algorithm flags as spam

  • Potentially upsetting content

(rxcerpt from

Based on everything we know about how the algorithm works, here are five ways to boost your performance and expedite your growth:

  1. Hook Your Audience Within Three Seconds

  2. Focus on a Niche

  3. Jump on Trending Audio

  4. Experiment with New Features

  5. Create Accessible Content

TikTok explained that, “neither follower count nor whether the account has had previous high-performing videos are direct factors in the recommendation system.”

This means that even if you only have a handful of followers, or have never posted to TikTok before, there’s still an opportunity for your video to go viral. Hooray!

Edgy Activity: Tick Tock Tours!

Activity: Take a Tour of TikTok

If your school hasn't blocked it, or if students are allowed to bring cell phones to school, try this:

  1. Split the class up into those with cell phones and TikTok accounts and those without. Students who would feel uncomfortable letting other students see their feeds can be in the "without" group.

  2. Pair people up so everyone is with someone who has a phone and an account. Try to pair people who are as different as possible! Students who manage their feeds can have 2 partners.

  3. "With" students give a tour to "without" students, who ask questions about what they see and watch what they wish to watch.

  4. Circle up. "With" people: What did it feel like to be visited? What did you realize about your feed, now that you saw it through the eyes of another person?

  5. "Without" people: What confirmed your ideas about Tiktok? About the person whose feed you watched? What surprised you about either? How informative is this site?