Every programmer and others uses a lot of algorithms in their life directly or indirectly(in case you are using an interface provided by someone and is uses algorithms at backend like using mobile phones).
Table of Contents
So what is an Algorithm?
In layman terms – It is a step by step procedure or a set of steps to accomplish a task.
And according to the popular algorithms textbook Introduction to Algorithms (by Thomas H. Cormen, Charles E., Ronald L., Clifford)- An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values as output.
So basically algorithm tells exactly how to do something to reach our goal or to achieve the required output or to accomplish our task. For example –
We use algorithms to find the shortest or the best path to travel from one location to another (Google Maps).
We use algorithms to do the weather forecasting.
We use algorithms for finding structural patterns and cure diseases.
For making games like chess that can defeat the best human in it.
For building smart robots ( like drones ).
And the latest, you can yourself imagine the kind of extremely complex algorithms for the path, energy, fuel etc. used by the Indian scientists to reach the MARS in minimum cost and in the most efficient way possible.
Real Life Algorithm Examples
Actually we don’t even notice but knowingly or unknowingly we execute a lot of complex programs in our daily life written using algorithms, like –
Have you ever noticed about the processing done at the server each time you check your email.
When you take a selfie, when you edit them when you post them to social media and get likes.
When you buy some products online and pay for it sitting at your home.
Think about the synchronization in the traffic lights of the whole city next time you stop there.
When you enjoy animation movie give a thought about the software and techniques used to make them.
And even while reading this a lot of work has been done by the servers, your machine, your browser, your ISP’s and what else.
So basically what algorithms do is that they provide a method of doing things, from our daily life to every other complex problem of the world. Even a simple program of adding, subtracting, multiplying is an algorithm and also calculating the speed, path, fuel of a space shuttle is done by using algorithms.
What is a Computer Program?
In computer world Algorithms are used by computer programs where a program –
=> Get input data -> process it using the complex logics –> stops when it find answer or some conditions are met-> produce the desired output
Now you have a pretty much idea about the algorithms and their usage in our lives but are all algorithms equals and if not then what differentiates them?
Factors deciding better algorithm –
No, there are some algorithms that are better than others and it is decided on mostly the two parameters-
The correctness of Algorithm – We want algorithms that give a correct answer always and in some scenarios where finding a correct answer takes a lot of time and resources we build our algorithms so as to give the best possible answer because that is best in such scenarios.
Efficiency of Algorithm (i.e. the time it takes, complexity, space requirement, universal application etc.)
Now to measure the efficiency of an algorithm we can definitely analyse and calculate the time taken by any algorithm to find the result and we can also compute the resources it has used but by this technique we will get the data only for the particular implementation, in a certain programming language, for a particular system (i.e. RAM size, Operating system, processor and other units) and for that particular input and we cannot analyse the behaviour of the algorithm when the input size changes.
For such conditions we use the Asymptotic Analysis that gives us the behavior of the algorithm and the respective change in time with the change in input size (as it calculates the time as a function input size) and did not consider other factors like programming language and hardware used. So by using this technique of Algorithm comparison, we can clearly find out which algorithm is better and which algorithm is best suited for our scenario.
There are few algorithms that are most commonly used in our computer world and knowing a variety of algorithms can help you identify your problem and solve it as there are huge chances that your problem would be related to some of them.
Types of Algorithms –
Some of the most common type of algorithms are-
Path finding Algorithms
Tree and graph based algorithms
Approximate Algorithms (In these cost of finding correct answer is too high so we make sacrifices in terms of correctness of answer and find nearly optimal answer).
Sequence Finding( Dynamic problems) and a lot more
We will be discussing a lot about Algorithms and their analysis in our future posts so stay tuned and subscribe and connect with us for more and regular updates.
Do share your views in comments if you find it helpful or anything missing or wrong. 🙂
What are Algorithms and why are they of utter importance? was last modified: August 5th, 2017 by Hitesh Garg
Thanks for reading this post. If you feel it to be worthy and helpful then don't hesitate in sharing this knowledge with the world. Don't you think it is a great idea to connect with us so that we can keep you updated. Google Plus Facebook LinkedIn Twitter Reddit