1. A familiar moment
You want tea in the morning. You don't stop to think how tea is made. You just do the steps, one after another: pour water, boil it, put a tea bag in the cup, pour the hot water over it, wait two minutes.
You just ran an algorithm. A real one, from start to finish. It happened to be about tea. Algorithms don't have to involve numbers.
Nothing in this course is much harder than that. We only learn to be more careful about the steps.
2. In plain words
An algorithm is an exact list of steps. It leads from what you have to what you want.
Every algorithm has three parts: an input (what you're given), the steps (what you do) and an output (what you get at the end). There is nothing else to memorize.
Input → steps → output. Every algorithm has this shape.
3. Why a computer needs it spelled out
Say you have a friend who does exactly what you say, no more and no less. You say "make a sandwich." He freezes. Which bread? What goes on it? Do you cut it first or spread first?
A computer behaves like that friend. It never guesses, and it never fills a gap for you. So an algorithm is written in small, clear steps. Each step must make sense on its own, with no guessing.
Here is a rule for the whole course. If a step can be read two ways, it is not a step yet. Break it into smaller steps.
4. Your turn (no code)
Here is a "recipe" for "which of two numbers is bigger." The steps are mixed up. Put them in the right order in your head.
- Say out loud: "the second is bigger."
- Take two numbers and call them A and B.
- If A is bigger than B, say "the first is bigger" and stop.
Correct order: 2 → 3 → 1. First the input (take the numbers). Then the steps (compare them). Then the output (the answer). The same three parts as the tea.
This recipe has one hole: if the two numbers are equal, it says "the second is bigger." Cases right on the boundary like this often break programs. We come back to them when we reach if/else choices.
5. Takeaway
An algorithm is a way to describe any task so precisely that anyone can repeat it, even a computer. From here on we learn one thing: breaking tasks into small, clear steps. We start with the simplest ones.
For people who already code. Yes, this is "function: args → body → return," plus determinism (the same input gives the same output) and finiteness (it stops at some point). We skip Big-O, invariants and data structures for now. They come later, when there is something to show them on. If you know all this, the first lessons take minutes. You will slow down later, at pattern recognition and the timed trainer.
On LeetCode
No LeetCode problem fits this lesson yet, because it writes no code. Every LeetCode problem has the same input, steps and output as the tea recipe, and your first real ones come in lessons 6 and 7.
Reading as a guest
Every free lesson is open to read and run. A free account marks lessons done and shows where you are in the course.