Algorithms in programming
In computer programming, the algorithm is describing a computer program step by step. Before we create a computer program, we create an algorithm to get an idea about that computer program. if any problem is in that algorithm, we can correct it before we create our computer program. we use a programming language to create computer programs. but we don't need any special language to create an algorithm. We can use simple English for that.
There are some important characteristics in algorithms.
- Well-ordered.
- Has unambiguous operations.
- Produces a result.
- Halts in a finite amount of time.
- Have effectively computable operations.
We can use some types to make algorithms. those are as follows.
- Normal English
- Structured English
The above two methods are also known as informal methods of algorithms.
- Pseudo Code
- Flow charts
The above two methods are also known as formal methods of algorithms.
Let's Look at some examples of algorithms.
for example, I will show you how to make an algorithm for adding two numbers & show output on a paper by each type of algorithms
Normal English
- first of all, get two numbers.
- then you have to add the value of both numbers into one.
- after that print value on paper.
Structured English
- Get two numbers
- Add two numbers into one
- Print value on paper.
Pseudo Code
- Start
- Declare value1, value2, sumof_two_value,
- Get values for value1 & value2
- Get sum of value1 & value2
- Assign sum into sumof_two_value
- Print sumof_two_value
- Stop
Flow Chart