In this tutorial, You will learn what is an algorithm in computer science in very simple words. You will also see various examples of algorithms.Â You have heard about **algorithm **somewhere and if you want to know what an algorithm is then read this. You will definitely know all about algorithms in simple words.

Let's start with a basic introduction to algorithms. **Algorithms **are nothing but a step by step procedure for solving any problems. Generally, algorithms are everywhere even the things we do in our daily life are similar to algorithms.

Let's take an example to understand the **algorithm **better. Your brother comes to meet you but he has not your address but he has your contact number and he is at the airport. Now, he wants to come to your house to meet you.

There are different ways he can come to your house.

- He calls you and tells you to come to the airport to pick him up.
- You call him and tell him to catch bus number TR1 and get off on New Market. Walk three-block south to my house.
- Hire a car ride of Uber. Follow the directions and come to my house.
- Don't wait just go to the Taxi stand, get inside the taxi and give the driver my address.

All the above ways are called **algorithms **because it solves the problem and let you both meet. All the ways perform the same goal but in different ways. Each way also takes different travel time and different costs.

In the same way, algorithms perform work and solve a problem in Computer Science. Now, a question comes in your mind What is **algorithm **in programming? Don't worry you will come to know quickly at last.

## What is an Algorithm?

In simple terms, anÂ **algorithm** is a well-defined list of steps for solving a particular problem in computer science. An algorithm is a well-defined list of steps that allows the computer to solve a problem.

Each and every task that is performed by the computer is due to algorithms. It is the **algorithm **thatÂ helps a programmer in solving the problems into a number of sequential steps.Â

A programming language is practiced to write a statement corresponding to each step. All these statements are collectively known as a *program**.Â *Once the programmers build the algorithms for any problem then it becomes easier for them to write the programs.

The **algorithm **tells the computer not only what to do but also how to do it.Â Algorithms are used for letting the computer understand what work to do and how to do it. It makes the work of the programmer easier because it is easier to write a program once you have an **algorithm**.

### Why is Algorithm so Important?

1. It enables communication between the team members.

2. Big problems are chunked down into smaller subproblems.

3. It does not depend upon programming language. For writing algorithms, you do not need the knowledge of programming.

4. It is easier to debug as it is written in English language.

5. With algorithms, it is easier to analyze the problem in a proper way.

6. It acts as a blueprint for the programmer for coding.

7. Stepwise representation of solution.

8. The finite number of steps is there in an algorithm.

9. Easier to understand as it is generally written in the English language. Non-programmer can also understand it.

### Disadvantages of Algorithm

- It is very time-consuming to write an algorithm.
- It is difficult to write an algorithm for a very big task.
- It is difficult to show looping in an algorithm.
- It is difficult to show branching in an algorithm.

### Characteristics of algorithm

- The steps written in an algorithm are well defined and precise.
- There is finiteness in an algorithm. There must have a finite step in an algorithm.
- An algorithm must have some inputs.
- An algorithm must have some outputs.
- Results of each and every steps are always defined and depends upon the inputs or previous steps result.

### Some Famous Algorithms in Computer Science

- Compression algorithm
- Route finding algorithms
- Rendering algorithms
- Optimization & Scheduling algorithms
- Minimax algorithms

**The Complexity of an Algorithm**

There is a time and space associated with each **algorithm**. The complexity of an algorithm is the function that gives running time or space in terms of the input size.

The time complexity of an algorithm describes the amount of time needed by an **algorithm **to do the desired task.

The space complexity of an algorithm describes the amount of memory space needed by an **algorithm **to do the desired task.Â The best algorithm is one that takes less time and needs less memory space.

**Importance of Algorithm**

**Algorithm **writing and drawing flowcharts are necessary for programming when the programmer needs to be more conscious about the work.

Not only the details of any **algorithm **need to be worked out in advance but each programmer should know about their task before coding.

When you go back to debug your code later, the program you wrote with an **algorithm **will be easier to manage.

### What makes a Good Algorithm?

Two factors make an algorithm good. They are:

- Correctness
- Efficiency