Do you know What is Algorithm? And if you do not know this, then you will not know how to write an Algorithm. But in today’s post, we are going to give you complete information about What is Algorithm?
Every day we get up at work as soon as we wake up in the morning. From the beginning to the completion of each work, some steps are followed. Every task is like a problem for you and the solution to the problem is found by working. To solve, we set a sequence. Let’s see What is Algorithm?
What is Algorithm?
Algorithm is a set of instructions that define the entire procedure to solve a problem. Its main goal is to achieve the expected output. There are several continuous steps, which are output only after it is finished.
This can be understood from the example of making a cup of tea:
Step 1. Fill the kettle with water
Step 2. Boil water
Step 3. Add tea leaves to the kettle
Step 4. Crush and add ginger.
Step 5. Add one and a half teaspoon of sugar
Step 6. Allow the tea to cook
Step 7. Strain the tea and put it in the cup.
In order to make a cup of tea, we have to execute the steps mentioned above in turn. In the same way, Algorithm is written to perform any Process or Task in Programming, so as to get the desired output.
It is used in many different fields, in which computer science and mathematics are main. For example Search Algorithm, this is a Step By Step process used to retrieve store web-pages within the Data Structure.
Also Encryption Algorithm is a mathematical procedure using which a data or message is encoded so that it is difficult to read or understand. Using this kind of algorithm, the data is kept out of reach of unauthorized users.
Who is the Founder of Algorithm?
It has a long history, but the real word “Algorithm” was first introduced in the 9th century. The then-Persian mathematician, Abu Abdullah Muhammad ibn Musa Al-Khwarizmi, is considered its founder. He is also known as The Father of Algebra.
In fact, Al-Khwarizmi was built on the work of Brahmagupta. Brahmagupta was a great Indian mathematician and astronomer. Both of these greats gained prominence when the word ‘Algorism’ was used to refer to Latin translations of their arithmetic rules using Hindi-Arabic numerals.
Then around the 18th century the word ‘Algorism’ became the modern “Algorithm”. In its modern form, it is well used for solving problems of daily life apart from areas like Calculation, Data Processing and Programming. So the word algorithm is the step by step process, which is designed to solve a problem or task.
Properties of Algorithm
We cannot call any procedure Algorithm. Rather, the algorithm should be useful, that is, it should solve the problem. For this to happen, an algorithm has certain properties. That is, it should meet the following minimum criteria:
1) Input : An algorithm must have well-defined input. Input is the data or information that we enter to provide output.
2) Output : It should produce the output. That is, the solution should be provided.
3) Unambiguous : Every Instruction or Step written must be clear. The input / output of each step should also be clear.
4) Finiteness : This means that steps written in the algorithm must terminate after a finite number. Finish means you should get the required output and not continue in the processing loop.
5) Effectiveness : Algorithm should be practical so that it is possible to execute instructions with the available resources. That is, there should not be any unnecessary instructions that make it ineffective.
6) Language Independent : Instruction should be written in simple language only. Which can be implemented in any programming language.
Examples of Algorithm
Various methods are used to write algorithms. Let us understand this with the easiest example.
Example 1– Calculating the average for 3 numbers.
Step 1. Start Step 2. Read 3 numbers A, B, C Step 3. Calculate the average by the equation Average = (A+B+C)/3 Step 4. Display Average Step 5. Stop
Example 2– Find the largest among three different numbers entered by user.
Step 1. Start Step 2. Declare variables a,b and c Step 3. Read variables a,b and c. Step 4. If a > b If a > c Display a is the largest number. Else Display c is the largest number. Else If b > c Display b is the largest number. Else Display c is the greatest number. Step 5. Stop
Does this fulfill the Criteria of being an Algorithm:
- In Algorithm the input and output are well defined.
- Each step is shown in a clear and precise sense.
- Steps Is a finite number. That is, Algorithm terminates after a time.
- Algorithm produces an expected output. We finally get the correct result.
Types of Algorithm
There are many types of this, but the most basic types are described below.
- Simple Recursive Algorithms
- Divide and Conquer
- Dynamic Programming Algorithm
- Greedy Algorithms
- Branch and bound Method
- Brute Force Algorithms
- Randomized Algorithms
What did you learn today
Writing a Logical Step-By-Step method to solve a problem is called Algorithm. That is, Algorithm is like a Plan to solve a problem.
This includes Calculations, Reasoning and Data Processing. There are many ways to write algorithms. Once we have Algorithm for a problem. Then we can execute it. It can be represented in common English language, Pseudocode and Flowcharts.
So hopefully, by reading this post What is Algorithm? you must have got to know about it. If you have any question related to this post. So we must comment.