Algorithm

Algorithm ( A Complete Introduction )

Writing a program is not a difficult task, we simply write any code using predefined statements and some simple algorithms. But there is also various complexity ( problems ) arrises while writing the program.

In this post, we will discuss the “use of an algorithm in programming”.

What is Algorithm

  • An algorithm is a step-by-step solution for any program which we write before creating the program.
  • In simple words, the algorithm is the analysis of any program written in proper format.
  • An algorithm contains the detail of any program so that any no technical person can easily understand it.

Need for an algorithm

  • An algorithm is a necessory part of programming because analyzing any program is a good practice for the creation of any program.
  • With the help of an algorithm of the program, we can easily analyze the space required as well as time is taken by the program which helps us to make a better program.
  • Analysis of the space required by the program is very necessary because a standard program can take less memory as compared to the normal program.
  • Similarly, by a proper algorithm we can create a program which will take less time as compare to other.

Examples of algorithm

-> An algorithm of a program to calculate the sum of two numbers.

  1. Start
  2. Take 1st input from the user
  3. Take 2nd input from the user
  4. Add 1st and 2nd numbers
  5. Print the result
  6. End

-> An algorithm of a program to find the average of 3 numbers.

  1. Start
  2. Accept 1st input
  3. Accept 2nd input
  4. Accept 3rd input
  5. Print the result
  6. End

 

 

 

 

Leave a Reply