TechnologyComputing

Algorithms: fun facts and quiz

The essentials in 7 ideas, with fun facts, an illustrated story and a quiz to see how much you know.

The essentials

Learn

What an Algorithm Is

Pixel-art picture: What an Algorithm Is

An algorithm is a set of clear steps for solving a problem, like a recipe. Computers follow algorithms, and so do people tying their shoelaces.

Key fact
The word comes from al-Khwarizmi, a 9th-century Persian mathematician.

Learn

Searching

To find a name in a sorted list, don’t start at the top: open the middle, see which half it’s in, and repeat. That’s binary search.

Key fact
Binary search finds one name among a million in about 20 steps.

Learn

Sorting

Sorting puts things in order. Simple methods compare neighbours and swap them; faster ones split the list, sort the parts and merge them back.

Key fact
A computer can sort a million items in a fraction of a second.

Learn

Recommendations

Streaming and shopping apps use algorithms to guess what you’ll like, based on what you and people like you chose before.

Key fact
Recommendations can trap us in a bubble of more of the same.

Learn

Fast & Slow Algorithms

Two algorithms can solve the same problem at very different speeds. As the input grows, a smart method can be millions of times faster than a naive one.

Key fact
Computer scientists describe speed with “Big O” notation.

Learn

Finding the Best Route

Pixel-art picture: Finding the Best Route

Map apps find the quickest route with shortest-path algorithms, like one Edsger Dijkstra invented in 1956, reportedly in about 20 minutes.

Key fact
Dijkstra designed it without pencil and paper, at a café.

Learn

Hard Problems

Some problems have no known fast algorithm. Finding the shortest trip that visits many cities, the travelling salesperson problem, gets explosively harder with each city.

Key fact
With 20 cities, there are over 60 quadrillion possible round trips.

Fun facts

Did you know?

Euclid’s method for finding the greatest common divisor is over 2,000 years old, and computers still use it.

Did you know?

Guessing a number from 1 to 1,000 by halving the range each time never takes more than 10 guesses.

Did you know?

Python’s built-in sort, Timsort, mixes two methods: merge sort for big runs, insertion sort for small ones.

Did you know?

Netflix once offered a 1 million dollar prize for improving its recommendations by 10%. A team won it in 2009.

Did you know?

Sorting a million items by comparing every pair takes about half a trillion steps; smart methods need about 20 million.

Did you know?

UPS plans its delivery routes to avoid turning across traffic where possible, saving fuel and time.

Did you know?

Proving whether problems like this can ever be solved quickly comes with a 1 million dollar prize.

Story: The Man Who Became a Word

Story time
Picture for the story “The Man Who Became a Word”

The Man Who Became a Word

Baghdad, around 825. Scholar Muhammad al-Khwarizmi writes a book on calculating with the Indian numerals, zero included.

Story time

Three centuries later it’s translated into Latin as “Algoritmi on Indian numbers”. Algoritmi is simply his name, spelled the Latin way.

Story time

Readers took it for a word for step-by-step calculation. “Algorism” slowly became “algorithm”, so every recipe for a computer carries his name.

True or false?

Tap your answer to see if you got it, and why.

  1. Question 1 of 10

    An algorithm is a defined sequence of steps.

    Show the answer

    True. Clear enough that anyone, or anything, can follow them.

  2. Question 2 of 10

    Binary search needs the list to be sorted.

    Show the answer

    True. Otherwise you can’t tell which half to keep.

  3. Question 3 of 10

    Some sorting methods split a list into smaller parts.

    Show the answer

    True. Like merge sort and quicksort.

  4. Question 4 of 10

    Recommendation algorithms learn from past choices.

    Show the answer

    True. Yours and those of similar people.

  5. Question 5 of 10

    Two algorithms can solve the same task at very different speeds.

    Show the answer

    True. The method matters more as the task grows.

  6. Question 6 of 10

    Map apps use algorithms to find routes.

    Show the answer

    True. Weighing distance, traffic and road types.

  7. Question 7 of 10

    Some problems have no known fast algorithm.

    Show the answer

    True. Nobody has found a quick method for them yet.

  8. Question 8 of 10

    Every algorithm has to be written in a programming language.

    Show the answer

    False. A recipe written in plain words is an algorithm too.

  9. Question 9 of 10

    Binary search checks every item one by one.

    Show the answer

    False. It halves the list at every step.

  10. Question 10 of 10

    All sorting methods are equally fast.

    Show the answer

    False. Some are far faster on big lists.

Soda the cat

Keep going in the app

KnowSoda learns what you know and brings back what you’re about to forget. Algorithms has 6 more ideas at the Advanced and Expert levels.

Get it onGoogle Play Coming soonApp Store

Sources