What Is an Algorithm? Recipes for Computers

Step-by-step instructions that solve problems

1

Algorithms Are Everywhere

You follow algorithms every day without calling them that. Getting dressed, making a sandwich, finding a book in a library. Click each example to see the algorithm behind it.

2

Order Matters

The same steps in a different order produce different results. Click the steps in the right order to complete the algorithm. Get it wrong and the result is a mess.

3

Efficiency: Two Ways to Search

Find the number 73 in a sorted list. Linear search checks each number one by one. Binary search jumps to the middle and eliminates half each time. Watch them race.

Linear: check each one. O(n). Binary: eliminate half each step. O(log n).
For 1000 items: linear checks up to 1000. Binary checks at most 10. For 1,000,000 items: linear checks 1,000,000. Binary checks 20.
4

Algorithms in the Real World

Every piece of technology you use runs algorithms.

Google Search

PageRank algorithm: rank pages by how many other pages link to them. More links from important pages = higher rank. Billions of pages, ranked in milliseconds.

GPS Navigation

Dijkstra's algorithm: find the shortest path through a road network. It explores outward from your location, always expanding the shortest known route first.

Social Media

Recommendation algorithms decide what you see in your feed. They predict what you will engage with based on what similar users liked. Billions of decisions per second.

Fun Fact

The word "algorithm" comes from the name of the 9th-century Persian mathematician Muhammad ibn Musa al-Khwarizmi, whose book on arithmetic introduced the Hindu-Arabic number system to Europe. His name, latinized to "Algoritmi," became the word we use today.

Algorithm Designer!

You've learned that algorithms are just step-by-step instructions. Every app, search engine, and game runs on algorithms. The key insight: break any problem into small, clear steps, and a computer can solve it.

0
Steps Completed
0
Time Exploring

Algorithms Are Recipes

A recipe is an algorithm: specific steps in a specific order producing a specific result. "Preheat oven, mix flour and sugar, bake 20 minutes." Computers follow the same idea.

Order Matters

Put on socks then shoes works. Shoes then socks does not. Algorithm steps must be in the right order to produce the correct result.

Inputs and Outputs

Every algorithm takes input (ingredients) and produces output (a cake). A search algorithm takes a query and outputs ranked results.

Efficiency Matters

Finding a word in a dictionary by reading every page works but is slow. Opening to the middle and narrowing down is fast. Both are algorithms. One is better.

Ready to Create?

Put your new knowledge into practice!

More Discoveries

Suggest a Correction