For those of you who don’t know, I’m a computer science student and an ever-curious programmer. The world my mind inhabits is a world full of beautifully complex computational problems swirling beneath the cold metallic objects we know as computers.
For most of my life, the processes governing this strange world have been mystifying to me. That is, until I decided to throw myself back into the foray of computer science to grapple with these difficult and ever-fascinating concepts.
As I attempt to grasp the core concepts of computer memory, a word about algorithms and data structures is in order. First, let’s ask the question, what is an algorithm?
An algorithm is any well-defined computational procedure, along with a specified set of allowable inputs, that produce some value or set of values as output. Defined another way by Judith L. Gersting in Mathematical Structures For Computer Science, “An algorithm is a set of instructions that can be mechanically executed in a finite amount of time in order to solve some problem.” Essentially, an algorithm is a set of instructions to the computer.
Typically, a programmer is interested in analyzing an algorithm’s efficiency. Or, more qualitatively, program complexity, which considers both the difficulty of implementing an algorithm and its efficiency.
To analyze efficiency, you must consider an algorithm’s space, which is the amount of memory required to execute the algorithm, and its runtime, which is the computational time required to execute.
The Job of a Programmer
Having defined an algorithm, you might be tempted to think, “ok, what’s your point?” Who cares about the formal definition of an algorithm?
Well, in short, you as the programmer should care.
The reason why? Because the main task of a programmer isn’t simply building cool things!
The major task of a programmer is devising algorithms, or rather programs (procedures), that solve the specified problem. Once a programmer has built a piece of software, their job isn’t done. They then turn to the algorithm itself to evaluate the algorithm’s efficiency and complexity in order to eventually develop a better solution in the future that is…