How Is An Algorithm Designed? Here’s The Thought Process Behind It

If we said that your day began and ended with an algorithm, it would still be an understatement. From turning off eerie chimes of alarm clocks to pulling down the curtains after binge-watching Netflix, modern man is under a deluge of algorithms.

Designing the right algorithm for a given application is a creative process. A problem has to be identified, a solution has to be sculpted out — sometimes remote and often oblivious to the domain of problem under consideration. Eventually, these pieces of solutions are threaded together to work in congruence with each other like a well-oiled contraption.

Being a successful algorithm designer requires a certain attitude — the ability to ask oneself questions to guide through the thought process. To use it effectively, you must not only ask the questions but answer them as well. For an algorithm designer, there is never an answer which says just “no”. But, “No, because…”

Subscribe to our Newsletter

Join our editors every weekday evening as they steer you through the most significant news of the day, introduce you to fresh perspectives, and provide unexpected moments of joy
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

Understanding The Problem

The first step for designing an algorithm is to begin with the premise of the problem itself, like, the components of an input and the desired results, or the importance of optimisation in obtaining the answers. Because this exploring this question will decide whether to use more or fewer steps in an algorithm. When the significance of an optimised solution gets decided, factors like speed come into the picture. As a numerical problem is different from a graph algorithm problem which in turn is different from a geometric problem. Different problems, different speed hence varied efforts.

Redundancy Check

This is more or a less an obvious one because who wants to reinvent the wheel? Every problem will be searched for available solutions both popular and obscure ones. In case of finding none, an algorithm designer has to recheck for other domains with sub-branches that overlap with the problem under consideration.

What Heuristics

Since, the above step gives an idea about the accuracies, time and speed, one can then conclude on the magnitude of effort required. And, if the solution is to be checked for precision and it needs a test which will lead to searching for the tests available or design a customised test. If a solution is found to be working then it should be checked for its repeatability i.e whether it gives approximately similar results with changing data; large value in the sample first or the smaller sample or a random one altogether. After determining the characteristic of the solution to certain samples, the ill-performing heuristics should be noted as well.

Checks And Balances To Make A Case For ML Algorithms

The sections prior to this dealt with how to start with a problem at a fundamental level. From a machine learning perspective, which deals with large chunks of unprepared, non-linear data, questions such as time and speed and, accuracies become increasingly important and the modern day gadgetry provisions it as well, with all the advancements in computational devices.

The following are few questions a machine learning researchers would face or should ask before they posit a new algorithm:

  • Are there any special cases for the problem under consideration?
  • Why can’t this special-case algorithm be generalized to a wider class of inputs?
  • How does the solution behave when few input parameters are left out?
  • Is there a way to split the problem into two smaller problems? Does this suggest a divide-and-conquer algorithm?
  • How can dynamic programming be used to exploit the order of the elements; like the branches in a decision tree?
  • Can directed randomness be used to simulate the actual scenarios?
  • Is the problem similar to NP-complete problem?
  • If yes, then is that the reason behind improper efficiencies?


Problem-solving is not a science, but part art and part skill. It is one of the skills most worth developing. And, finally, the most important question that a researcher should save for the last, like we did in the article is, why not start again from the beginning and work through these questions again and if any of these answers have changed since the last trip?  Noted author and computer researcher Steven Skiena rightly said, “In algorithms, as in life, persistence usually pays off.”


Ram Sagar
I have a master's degree in Robotics and I write about machine learning advancements.

Download our Mobile App


AI Hackathons, Coding & Learning

Host Hackathons & Recruit Great Data Talent!

AIM Research

Pioneering advanced AI market research

Request Customised Insights & Surveys for the AI Industry


Strengthen Critical AI Skills with Trusted Corporate AI Training

Our customized corporate training program on Generative AI provides a unique opportunity to empower, retain, and advance your talent.

AIM Leaders Council

World’s Biggest Community Exclusively For Senior Executives In Data Science And Analytics.

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox