Algorithm

Why Trust Techopedia

What is an Algorithm?

An algorithm is, in its purest sense, a mathematical process for solving a problem using a finite number of steps. In the world of computers, we define an algorithm as a set of instructions that specifies not only what needs to be done but how to do it. It processes inputs, such as numbers or data, to produce outputs, such as results or solutions.

Advertisements

Algorithms are essential to processing data and executing functions in computer science, mathematics, and artificial intelligence (AI).

What is an Algorithm

Key Takeaways

  • An algorithm is a finite sequence of instructions to define a task or solve a problem.
  • Algorithms are essential in computer programming and AI, enabling computing systems to execute tasks.
  • Algorithms are increasingly used in various areas of modern life, from location tracking to social media to finance to healthcare.
  • The effectiveness of an algorithm is typically measured by how quickly and accurately it works to process inputs – in the form of data – to deliver outputs such as analysis or decisions.
  • Algorithms are useful for automating data processing and scaling up as the volume of inputs grows, but they can be resource-intensive and complex, and may not be suitable for applications that do not have complete data or require flexibility.

How Does an Algorithm Work?

In the computing field, most algorithms tend to solve data management and analysis problems.

Algorithms are written in code, which a machine then implements. Algorithms work by following a series of instructions to perform a specific task.

There are typically three steps:

  1. Input, in which the algorithm receives data.
  2. Processing, which involves performing calculations or making decisions based on the data.
  3. Output, in which the algorithm produces a result or solution.

Probably the best way to understand an algorithm is to think of it as a recipe. There are many ways to bake cookies, but by following a recipe, a baker knows to first preheat the oven, then measure out the flour, add butter, chocolate chips, etc. until the desired cookies are complete.

For example, using an AI marketing tool that incorporates algorithms, a programmer or computer scientist can tell a machine to query database A for last month’s sales figures, compare them to the prior month and the same month last year, and then display it in a bar graph.

Mix multiple algorithms together and you have a working computer program.

Networking also relies heavily on algorithms, which govern everything from packet routing and traffic management to security and encryption. Traditionally, routing algorithms were largely static in that they established fixed points of network activity. Recently, however, network providers have shifted toward more adaptive algorithms that can make changes on the fly in response to traffic or topology considerations.

Types of Algorithms

There are numerous types of algorithms for virtually every kind of mathematical problem there is to solve.

These include:

  • Numerical algorithms
  • Algebraic algorithms
  • Geometric algorithms
  • Sequential algorithms
  • Operational algorithms
  • Theoretical algorithms

There are also various algorithms named after the leading mathematicians who invented them:

  • Shor’s algorithm
  • Girvan-Newman algorithm
  • Several Euclidian algorithms

There are also those named after the specific problem they solve, such as:

  • Bidirectional search algorithm
  • K-way merge algorithm

Top Computing Algorithms

Top Computing Algorithms

There are seven primary types of algorithms, according to Ohio State University:

Sort
Arranging data in an efficient and useful manner. These include quick sort, merge sort, counting sort, and others.
Search
Finding key data in sorted data sets. Binary search is used for searching in linear data structures and sorted data sets. Depth/Breadth First Search (DFS/BFS) is used for Graph data structures and is employed by search engines for web crawling.
Hashing
Similar to search but with an indexing and key ID component. Hashing provides superior results because it assigns a key to certain data.
Dynamic programming
Converts larger, complex problems into a series of smaller problems.
Exponential by squaring (EbS)
Also known as binary exponentiation, EbS speeds up the calculation of large integers, polynomials, square matrices, and other complex problems.
String matching and parsing
Designed to find patterns in large data sets using predefined terms and restrictions.
Primality testing
Determines prime numbers either deterministically or probabilistically; mostly used in cryptography.

Use of Algorithms

Algorithms are used in nearly every aspect of data processing. In AI and machine learning (ML), algorithms enable computer systems to identify patterns, predict outcomes, and make decisions.

Algorithms are increasingly used on the Internet, for instance, to rank search engine results based on relevance and suggest content to social media users that is likely to suit their interests.

Algorithms are used in banking, for instance, to identify potential fraud and screen applications for loans and other financial products. They are also used in trading to analyze market trends and execute automated trades.

In the healthcare sector, algorithms can analyze patient and research data to assist in diagnostics and treatment planning.

6 Characteristics of an Algorithm

  1. Independent

    An algorithm’s instructions should be independent of any programming code and be able to run in any programming language.
  2. Definite

    Algorithms must be coded in detail to specify each step in a sequence.
  3. Specified input

    An algorithm needs well-defined inputs to be able to produce the output.
  4. Specified output

    The algorithm also needs to specify the outputs that it should produce from the data and the format it should take.
  5. Effective

    An algorithm must be written to be efficient, feasible with the data and resources available and does not contain any unnecessary steps.
  6. Finite

    An algorithm must terminate after a definite number of steps, either by providing the expected output or a response that a solution is not possible.

Algorithm Examples

Algorithms are present in all aspects of modern life, from traffic signals to social media and online shopping.

Examples include:

Global Positioning System (GPS)Facial recognitionGoogle searchSpotify

GPS transmits signals to satellites and uses an algorithm to calculate and track the location of a user. This allows apps to map out routes with their distance and travel time.

Biometric logins for cell phones and other devices run on an algorithm that uses biometric maps to plot facial features and compare them to its database to find a match.

Google’s PageRank algorithm determines the order of search results displayed in its search engine by assigning a score to each result. The higher the score, the higher up the results page a website will appear. The algorithm is designed to organize the indexing of millions of web pages in a usable way.

Streaming services such as Spotify use algorithms to analyze the content users consume and present them with related content that they are likely to engage with so that they continue using the service.

Algorithm Pros and Cons

Pros
  • Well-designed algorithms can process data quickly while making the best use of resources
  • Computing algorithms can automate the output of highly accurate results
  • Algorithms can scale up to handle increasing volumes of data without significant deterioration in performance
Cons
  • Algorithms with large computational requirements can require a lot of resources, which can be costly
  • Some algorithms can be difficult to understand, code, and implement
  • Some algorithms can lack flexibility and require complete inputs to function correctly

The Bottom Line

The definition of an algorithm is a series of steps that sets out a task and defines exactly how to complete it. Algorithms are foundational to computing, underpinning everything from simple tasks to advanced AI systems. Algorithms can automatically sort data, find information and identify patterns, and make predictions or decisions, quickly and efficiently.

As technology becomes even more ubiquitous and we find ourselves relying on smart cars, smart homes, cities, and even smart bodies, it may seem like we are interacting with an entirely new form of consciousness on the planet, one that walks, talks, and thinks.

In reality, though, it’s just lots of numbers running through lots of algorithms.

FAQs

What is an algorithm in simple terms?

Which is an example of an algorithm?

What does an algorithm look like?

Why do we need algorithms?

What is a standard algorithm?

Advertisements

Related Terms

Nicole Willing
Technology Journalist
Nicole Willing
Technology Journalist

Nicole is a professional journalist with 20 years of experience in writing and editing. Her expertise spans both the tech and financial industries. She has developed expertise in covering commodity, equity, and cryptocurrency markets, as well as the latest trends across the technology sector, from semiconductors to electric vehicles. She holds a degree in Journalism from City University, London. Having embraced the digital nomad lifestyle, she can usually be found on the beach brushing sand out of her keyboard in between snorkeling trips.