# Algorithms-Introduction

--

Algorithms is a place skipped , less understood or most of the time very rarely mentioned in the field of IT for beginners. The less importance given to algorithms compared to the rest of the things like Responsive Web designs , Frameworks , Coding by the people in the field can be one reason for this .

But when it comes to real world applications to solve a problem or compose a code to a particular function algorithms play a vital part. Also although it’s not highlighted much , even if you are going to face an interview or a quiz in order to be a part of a top notch company. Algorithms is a must learn thing.

But What are these algorithms? Why is it important? What’s the use of it?

# What is an Algorithm?

Simply said an Algorithm is a set of instructions for accomplishing a task .

If we want to define it in a more biased way for the field of programming we can come up with a definition like , “A specific set of codes given to run a program” That might not be an accurate definition , since that was my words put together to a sentence to get a rough idea. In-fact every piece of code can be know as an Algorithm .

The term algorithm can also be used in common tasks too, as an example :

The different ways which a set of people use to solve the same problem are the different algorithms to solve that problem . Some solutions which people come across maybe simple and efficient and some maybe complex and time consuming.

But the short efficient methods as well as the long complex methods both can be included into algorithms. Because despite the complexity and time efficiency both solutions solve the problem.

# A Simple example

We are told to guess a number between 1 and 10 , and the person who tells us to guess the number already has a number in his mind, which is also between 1 and 10. Now our job is to guess that number correctly.

This can be done many ways as in,

- Guess some random number each time,
- Guess starting from 1 and approach in ascending order, (Linear search)
- Start Guessing in the descending order,
- Use the Binary search (We will go through it in the next writing) ,

So these are some ways which we can use to come up with a solution . .And as we went through earlier these methods can also be known as Algorithms which solve the particular problem.

Moreover, ever found shortest path from Place A to Place B on Google Maps? Ever rolled a dice just by a click in an online game? Ever used search functionality in a website? One thing which is common to all these scenarios is that one or other algorithm is being run and results are being delivered.

But each of these ways of getting the answer to the problem requires different amounts of attempts to reach the target. But at the end all these problems may solve the problem,…

# So Efficiency does not matter?

The answer is efficiency is “the matter” . How fast and efficiently can an algorithm solve a problem is the fact to be considered here.

In real time problems we will be using algorithms composed by others quite often. But when using those algorithms we should have an understanding about how fast or slow those algorithms functions in order to apply them into our specific tasks.

So there are methods/ ways to identify or calculate the efficiency of an algorithm . A most common way is to use BigO notation . (We will take a deep dive into BigO notation in another blog post )What this notation does is , it gives us a measurement of how long it will take to solve the problem using a particular algorithm.

But Remember the “how long” question will not be answered in terms of a definite scale like seconds or minutes . But this measurements will be given in terms of attempts used per algorithm kind of a way.

The methods and the specific names of the algorithms will not be discussed here since this is a short introduction to algorithms. We will go through them one by one in upcoming posts.

Coming up next :- Linear search , Binary Search, BigO notation