What is an algorithm and why should you care? | Algorithms | Computer Science | Khan Academy

An algorithm is like a recipe for solving a problem, simple, step-by-step instructions that anyone can follow.

Imagine you're making your favorite snack: cookies! You have all the ingredients, but if you don’t know the steps, like mixing flour and sugar first or baking at 350°F, you might end up with something strange instead of a delicious cookie. An algorithm is just like that recipe: it tells you exactly what to do, in what order, so you get the right result.

How Algorithms Work

Think of an algorithm as your friend who knows the fastest way to get from school to the park. They don’t just say “go there,” they say, “turn left at the corner store, then walk two blocks.” That’s how algorithms help computers, they give them clear instructions so they can solve problems quickly.

Why You Should Care

Algorithms are everywhere! When you play a video game and your character jumps over obstacles, or when your phone finds the best route to school, that's an algorithm working behind the scenes. Understanding them helps you see how things work, and maybe even make them better! An algorithm is like a recipe for solving a problem, simple, step-by-step instructions that anyone can follow.

Imagine you're making your favorite snack: cookies! You have all the ingredients, but if you don’t know the steps, like mixing flour and sugar first or baking at 350°F, you might end up with something strange instead of a delicious cookie. An algorithm is just like that recipe: it tells you exactly what to do, in what order, so you get the right result.

Take the quiz →

Examples

  1. A recipe for baking cookies is like an algorithm: it tells you the steps to make a perfect batch.

Ask a question

See also

Discussion

Recent activity

Nothing here yet.