Let’s say that I gave you a shuffled stack of cards with a bunch of different people’s names on them, and told you to put them in alphabetical order. How would you do it?
Well, there’s a few ways. You could start laying the cards out in a line, roughly where you expect them to be in the alphabet. Then add cards on either side of the ones you already put down, depending on the letter. Or maybe you could flip through all the cards, pull out all of the A names, then go back through and do it again for all the B names…
Some of these ways will be faster than others. But you could write your way down as a set of simple instructions that anyone else could follow with their own set of names to sort. That set of instructions — the process by which you sort the cards — is an algorithm.
Remember, that computers are very, very stupid. They are very good at following very precise instructions, but they are not good at thinking on their own. If you want a computer to sort names in alphabetical order, you need to tell them exactly how to do it. Some of those ways will be super fast, where other ways might take the computer a while.
Computer scientists like to come up with many different clever ways of doing things like sorting names. The actual code, or which computer coding language you use to actually write the algorithm, isn’t as important as making sure the algorithm is efficient and well designed. If you have millions of names to sort, the right algorithm might be hundreds of times faster than a slower one.
When Facebook had to write it’s “news feed“ feature, someone needed to design the specific set of instructions and criteria that determine which posts get put into your feed. These rules are an algorithm. These days in pop culture, it’s just called “the algorithm“ because the exact set of rules are secret, and Facebook won’t tell you exactly what they are.
Latest Answers