What is an algorithm?

A screen showing code written in Python, with purple light reflecting off the surface
(Image credit: Bigstock)

A simple answer to the question "what is an algorithm" is that it is a set of rules used by a computer to solve a problem. As technology has advanced, the algorithm has become more and more complex, powering software and many things around us. Today, they've become the complicated law that powers and controls seemingly everything in the IT world.

It hasn't always been the case though; algorithms are a form of maths that has been around long before the internet and computers as specifications for performing calculations, data processing and automated reasoning.

They are rules used to automate the treatment of a piece of data. If 'a' happens, then do 'b'. This is the logic that most systems run on, for example, if a user calms to be 18 they can access certain websites, if not, the website will be told to print "sorry, you must be 18 to enter".

This basic example can be found in many more complicated and intricate guises around the world and in many of our most used services.

Algorithms are everywhere

When you type a search into Google, you're making use of Google's web ranking algorithm. This determines which articles should be displayed above others based on a range of factors, and is the core focus of search engine optimisation (SEO) marketing.

The important thing to consider is that how certain algorithms work is usually a very well-kept secret, with few companies giving away how they were developed. Their running is hugely complex too, taking hundreds, if not thousands of different factors and pieces of information into account.

Facebook, Twitter, LinkedIn and Instagram all use algorithms to decide which posts to show to who and probably the most recently popularised is Facebook's, which prioritises personal connections above branded content. It analyses what you interact with most and shows more of those to make sure you're only seeing the content you're interested in.

At complex levels, algorithms form the basis for machine learning (ML) models, which assist computers in tasks such as sequencing complex data sets. They also lie behind pattern recognition models such as facial recognition.

What are some different types of algorithms?

Although algorithms come in many different types and sub-types, some are commonly used for specific purposes.

Encryption algorithms

Some of the most-commonly used algorithms, these are utilised to encrypt data according to a set key. This can later be decrypted for select users, allowing for secure access to a string such as a password or sensitive information. Common protocols to encrypt data include Advanced Encryption Standard (AES), which applies 128-bit, 192-bit or 256-bit permutation and substitution boxes to a chosen string. This results in an encrypted string and an encryption key, which can later decipher the information.

Hashing algorithms

These are used to obfuscate data to make it indecipherable. Once a user has input a string they want ‘hashed’, the algorithm runs a complex series of calculations to compress the string into a set of fixed-length bits, containing seemingly-random combinations of letters and numbers.

Unlike encryption algorithms, hashing algorithms use a one-way process that is difficult to reverse. The aim is not to produce data that can only be accessed by certain individuals, but to create a unique string that is totally obfuscated. Hashing algorithms are often used for rendering digital signatures for verification checks. They’re an ideal solution for this task, as sensitive data can be made completely unreadable while also retaining unique characteristics that allow for it to be checked against other hashed data.

Bubble sort algorithms

Bubble sorts are amongst the simplest sorting algorithms used in computer science. They run through a list, directly comparing each value with the next along and swapping them if a condition is met. For example, if you’re looking to sort a list of numbers from smallest to largest, the bubble sort algorithm would compare the first value in the list against the next and swap the two if the first was the larger of the two. This continues all the way along the list, with the algorithm starting over until it does a run through in which no values are swapped.

Divide and conquer algorithms

Programmers often turn to divide and conquer algorithms to achieve the most efficient solution to a problem. An algorithm of this kind breaks up a problem repeatedly until it is a series of smaller problems that are simpler to solve. It then combines all the individual solutions into a solution for the original problem. These are typically used for functions such as merge sorts, in which an array is broken down into its individual values which are then compared and put in order.

Brute force algorithms

One of the top password-cracking techniques used by hackers, brute force algorithms produce a solution by going through all possible combinations of an input. For example, if you know the length of a password and the first few characters, a brute force algorithm can be used to cycle through every other alphanumeric combination that could fill out the rest of the password. This can be resource intensive and take a long time, but modern computer hardware such as GPUs can be used to speed up the process considerably.

Humans and algorithms have a complex relationship

Some more advanced systems, such as TikTok’s algorithm for content recommendation, have been praised for their ability to accurately react to individual user taste. However, while a portion of this process is automatic and defined by user input, recommendation algorithms are also maintained by back-end employees.

In some of the worst cases, employees are tasked with training algorithms to detect unsuitable or illegal content and have to watch the content themselves to manually flag it.

Some firms have taken steps to give people a better idea of how their algorithms work. In July 2022, TikTok committed to a new API for researchers, enabling greater transparency and oversight of its filtering system, while Google regularly posts advice on how its ranking algorithm has changed so that publishers can ensure their content does well on the platform.

RELATED RESOURCE

The case for an accelerated device refresh cycle

Achieving a more cost-effective device lifecycle overall

FREE DOWNLOAD

In the past, concerns have been raised about the power of algorithms to shape user experience and public opinion. The fact that social media algorithms show users content that has been deemed most relevant to them runs the risk of entrenching beliefs, and preventing individuals from accessing opinions that challenge their own.

Regulators in the UK including the Competition and Markets Authority (CMA), Financial Conduct Authority (FCA), Information Commissioner’s Office (ICO), and Ofcom have called for wider scrutiny of algorithms. They argued that algorithms carry the potential to harm users, and could impact online safety and innovation.

In a more specific example, Facebook was discovered to have missed tens of thousands of Russian-sponsored adverts during the 2016 US presidential election. This led to an internal reassessment of the algorithm, driven by a concern that posts containing obvious misinformation had not been checked over by humans.

Bobby Hellard

Bobby Hellard is ITPro's Reviews Editor and has worked on CloudPro and ChannelPro since 2018. In his time at ITPro, Bobby has covered stories for all the major technology companies, such as Apple, Microsoft, Amazon and Facebook, and regularly attends industry-leading events such as AWS Re:Invent and Google Cloud Next.

Bobby mainly covers hardware reviews, but you will also recognize him as the face of many of our video reviews of laptops and smartphones.