What is an Algorithm
We are not using algorithms in computer science only we all are using algorithms in our daily life.
Let see us take one example if we want to make tea in that case what we will do?
We will follow some steps first we will take a pan then add some water in it and we will put that pan onto flame then add some tea leaves and ginger whatever we want to add then some milk sugar and we will leave that pan onto that flame for some time maybe one minute two minutes like this and our tea is ready.
Obviously to make tea we are following some steps this there is a proper process.
In computer science language if we will say this as an algorithm means informally if we define that is set of steps to accomplish a task. In real life in informal ways, we will define like this task. And this is only one example. There are many examples like this to make sandwich, to make a phone call also, we are following algorithms.
The proper definition of algorithm is finite sequence of instructions used to solve a problem or solve a computational problem.
Properties of Algorithm
Basically, algorithm have two properties
1. Finite and unambiguous
2. Correctness
Why we need Algorithms
Let us take a real-life example like if we want to construct a building in that case first of all what we will do?
Obviously, we design a map and then start construction if we want some update then we update that map only and then actually construction should be started.
Without map, without any planning, without any designing start directly construction if we don't Like anything then destroy that already constructed building and again start construction. If we do so like this it's waste of money, wastage of time.
So, what we can say that map is algorithm and the construction actual program. For better construction map is necessary so in computer science language we can say to design a better program algorithm are required.
First, algorithms are written then programs are written. So, we can say to design better programs algorithms are required.
The Differences Between Algorithm and Program
Algorithms vs Programs |
Algorithms are free from grammatical rules
- Content is more important than form
- Acceptable as long as it tells people how to perform a task
Programs must follow some syntax rules
- Form is important
- Even if the idea is correct, it is still not acceptable if there is syntax error
Algorithm and programs are basically dependent on hardware and software.
Post a Comment
Post a Comment