What is an algorithm
"Algorithm" isn't a hard word. It means "a set order of steps for solving a problem." Like cooking noodles or finding your way, once the order is set, anyone who follows it gets the same answer.
The steps for making a sandwich
Say you're making a sandwich.
Take out the bread, spread the jam, put the other slice on top.
Follow these set steps one by one and the sandwich is done.
That's an algorithm.
Each press of "next step" moves the order forward one step. Take out bread → spread jam → cover → cut → done.
That word "algorithm" that sounded so hard is really just this.
Deciding what to do first and what to do next: setting the order.
Recipes and assembly instructions are all algorithms, in a way.
Socks first, or shoes first?
Order isn't arbitrary.
Put on your socks and then your shoes, and it works.
But try putting on your shoes first and then your socks, and it doesn't.
Wrong order, wrong result.
Change the order and the result changes. Right order → it works · reversed order → it doesn't.
That's why order matters so much in algorithms.
What you do first decides whether it works or not.
It's not just knowing the steps; it's knowing the right order.
Same order, same result
Here's the power of a set order.
If I follow it and my friend follows it too, we both get the same answer.
It doesn't depend on mood or luck: same order, same result.
Follow the same order and both get the same answer. Me → 7 · friend → 7.
This is good because you can rely on it.
"Do it in this order, and you'll always get this answer."
So if you write this order down for a computer, it does the same thing every time.
Finding the bigger of two numbers
Let's follow one really small algorithm together.
It finds the bigger of two numbers.
"Compare the two, pick the bigger one." That order is all it takes.
Put in the input and out comes the answer.
Input → steps → answer. Number A 7 · number B 4 → compare → answer 7.
It may not look like much, but small orders like this, piled up, do amazing things.
They line up thousands of items and find what you're looking for.
It's all the power of a set order.
To have a computer do it
A computer can't figure things out on its own.
We have to write down what to do and in what order.
That order is the algorithm, and if we write it well, the computer does the job quickly and accurately.
Now that you know the idea of order, what's next. Algorithm = steps for solving a problem → sorting · searching · beyond.
Whatever algorithm you meet from now on, there's no need to be intimidated.
However complicated it looks, inside it's the same.
It's just an order that says what to do first and what to do next.