An algorithm is a sequence of steps to solve a problem. Its purpose is to find the solution to a particular problem. The scope of an algorithm is not limited to mathematical or logical concepts.

Algorithms can be thought of as a procedure to a solve problem. Listed below are the criteria for a procedure to be an algorithm:

- The procedure must ultimately provide the solution to the problem being addressed. It should be finite.
- Each step in the sequence must be clear-cut and understandable.
- The algorithm must be effective.

Let’s learn by example. Here’s a trivial and simple example of an algorithm to make toast:

- Get bread from cupboard
- Remove toaster from drawer
- Put bread in toaster
- Turn on and sent temperature / timer
- When toast pops up add butter
- Eat and enjoy

When it comes to finding the solution to a problem, there can be multiple approaches. For instance, to find the GCD (Greatest Common Divisor) of two numbers, we can use the Euclidean algorithm, the Lehmer’s GCD algorithm and many other methods. Since a given problem can be solved in multiple ways, people often spend a great deal of time comparing algorithms to determine which one works best in a given situation.

In their book, Algorithms for Dummies, John Mueller and Luca Massaron provide a list of some common use cases of algorithms:

- Searching

eg: finding a particular web page in the sea of web pages on the internet - Sorting

Sorting information or data is arranging in an ordered sequence.

eg: when you arrange items on e-commerce sites in increasing order of price - Transforming:

Conversion of one sort of data to another

eg: Shunting Yard Algorithm is used to convert an infix expression to postfix expression - Scheduling

According to Wikipedia, scheduling is the method by which work is assigned to resources that complete the work. If it weren’t for scheduling algorithms, then your operating system wouldn’t have been able to efficiently allocate resources for specific tasks at the right times or run multiple tasks at the same time.

eg: in the Shortest Remaining Time algorithm, the process will be allocated to the task which is closest to its completion - Graph Analysis

A graph is a non-linear data structure comprised of nodes and edges (which connect a pair of nodes). Graphs have innumerable real-life applications: social networks, recommendation engines, etc.

eg: The breadth-first-search algorithm is used to find the shortest path between two nodes. An application of this could be the shortest route between a source and destination on Google Maps. - Cryptography

Encryption is a process of encoding messages to keep them secret, so only “authorized” parties can access the message. This is an important concept for the safe transfer of data between systems and protection against attacks and malicious penetration. Algorithms exist which analyze information and encrypt/decrypt the information.

eg: Message Authentication Codes (MACs) can be used in providing authentication for the origin/source and integrity of messages. - Pseudorandom Number Generation

These algorithms use mathematical formulas to produce sequences of random numbers.

eg: electronic games and simulations

This list is a tiny glimpse into the types of algorithms out there. New algorithms are made everyday and existing algorithms are continuously modified. The job of computer programmers is to identify which algorithms are suited for their projects or work.

*************************

Important resource: Here’s a list of algorithms: https://en.wikipedia.org/wiki/List_of_algorithms

Want to join on my learning journey? Feel Free to subscribe!