Chapters 1 -2 of The Algorithm Design Manual
These chapters introduce what algorithms are and how to analyze them. This is basic Algorithms 101 stuff – what is an algorithm, correctness and efficiency, examples of Big O/Omega/Theta notation, worst/best/average-case complexity, etc. I don’t want to rehash this material as there are other, better places for that.
I do want to discuss one idea that really charmed me.
What is an algorithm?
Technically, algorithms are procedures that accomplish a specific, well-defined task. While true, this is a dry, formal, and uninteresting definition.
In describing what an algorithm is, Skiena says,
“Algorithms are the ideas behind computer programs.”
What a beautiful statement. I love that way of looking at algorithms. I love the idea that algorithms are the heart and soul of programs. They’re the core – constant despite language, location, and hardware. I’ve never heard of algorithms described this way. All of a sudden, constructing algorithms stops being this boring way to solve problems in a textbook and becomes a process of discovering the life force of a computer program.
In the past, I knew that a program was executing a set of instructions and that set of instructions was conceived by humans – but this is a cold, heartless worldview. Those “set of instructions” are the idea behind a program. There’s another level of depth here.
In my mind, this crystalizes what algorithms really are. Hidden behind the code, they are the drivers of how to solve a particular problem – they are the ghosts in the machine.
I know that this post may be too grandiose but, I think I’m so attracted to this because the word ‘idea’ has such a romantic meaning to me. A great idea has the power to change the world.
In one sentence, algorithms have just been given that power.