Making Sense of Algorithms: General Perspective
By: Dave Amiana
Tags: Mathematics, Computer Science, Programming, Algorithms

An algorithm describes the ordering of procedures for obtaining specified results.

In the parlance of mathematics and computer science, an algorithm pertains to a finite sequence of well-defined computer-implementable instructions, typically to solve a class of problems or to perform a computation [1–2]. Algorithms are essential for data and information processing in computers. Historically, computers are people that can carry out the process of computations through a series of operations. Thus, the antiquity of algorithms can be traced back to the Babylonian Mathematics of c. 2500 B.C [2] — the division algorithm. Greek mathematicians have used the concept of an algorithm in investigating patterns of numbers such as the Euclidean algorithm which is a method for finding the greatest common divisor given two numbers. And Eratosthenes’ method for finding prime numbers[2].

Broadly speaking, an algorithm is a series of instructions expressed for an agent being capable of carrying through such a process to execute. Further formalizations suggest that an algorithm be expressed by a Turing-complete system [3–4]. A formal system, say a programming language, is said to be Turing-complete is it can emulate the abstract Turing machines. In other words, a Turing-complete language is theoretically capable of expressing all tasks accomplished by computers [5] as Turing machines bear to be the theoretical representation of a computer. Therefore, expressing algorithms in such a manner not only simplifies but also logically formalizes the series of procedures.

On Expressing Algorithms

One can express algorithms in various forms: either in a natural language that we use every day or in an artificial language that is constructed with specified grammatical syntax and vocabularies — e.g. cookbook recipes and methods explained in English or Pseudocodes. By the same token, algorithms are independent of languages they are expressed upon. Additionally, there are means as to how we could sort out the representation of algorithms for varying purposes.

In developing a solution for a given problem, one has to follow an iterative development approach — planning, building, testing, and revising. In that sense, a representation of an algorithm, in varying degrees of abstraction, might be helpful for generating solutions. We can categorize these degrees as follows:

High-level description : a statement that describes an algorithm without necessarily specifying implementation details.

: a statement that describes an algorithm without necessarily specifying implementation details. Implementation description: directives that specify the implementation, plausibly with respect to the language e.g. pseudocodes or C++ code.

In the same way, data structures and algorithms are represented abstractly (which only gets into the essence of the matter) before it can be implemented in a codebase[4]. One has to begin with a high-level (abstract) description to picture the given case: for this inputs what are the expected outputs? What are the key procedures? Among others, Input-Processing-Output (IPO) diagrams might be helpful for this.

IPO chart to get weekly pay (source).

In expressing algorithms, one has to keep in mind that it needs to be concise because vague expressions lead to confusion which could impact the time it takes to implement the algorithm. In that sense, natural language should not be left without constraints; constrained natural language is in fact an artificial language[6]. We will not be going to talk about the linguistic features of these expressions further since the notion of an algorithm does not depend on the language: for practical reasons, we ought to specify and constrain linguistic features to account for simplicity, organization, and clarity when we express algorithms. The point is that expressing algorithms has to be concise (in a manner that it is descriptive and imperative).

It might be helpful if you learn to use visual languages (such as UML and flowcharts) and pseudocodes to develop the design of your algorithm.

Features of an algorithm [4]

As the situation varies, we are presented with different frames of problems; we are also tasked to formulate different flavors of our recipe — algorithms.

It is important to define the features of an algorithm to have some sense of selecting the ideal algorithm. Here we define helpful terms one has to keep in mind before deciding which kind of algorithm to implement in a given situation. As the situation varies, we are presented with different problems, we are also tasked to formulate different flavors of our recipe — algorithms.

Correctness — pertains to the relevance or the appropriate use-case of an algorithm to solving a problem.

— pertains to the relevance or the appropriate use-case of an algorithm to solving a problem. Main t ainability — often pertains to the reliability and the readability of an algorithm.

— often pertains to the reliability and the readability of an algorithm. Efficiency — pertains to how an algorithm’s performance changes as the size of the problem change.

Photo by William Felker on Unsplash

Characteristics of an Algorithm

While algorithms describe procedures, not all procedures can be called an algorithm. In this sense, an algorithm should have the following characteristics[7]: