An algorithm is a step by step description of a process. In our day to day life, we perform hundreds of various actions based on our requirement and situation. These actions are pretty much similar to an algorithm. Actions could be anything from making tea to creating some art.

Before doing anything you develop some strategy. Same thing you will do while developing any program. You will first define your programming steps in the form of an algorithm.

Algorithm

Describing step by step flow of the process is known as algorithm and presenting this steps of the process in the form of a diagram is known as the flowchart.

An algorithm is also known as pseudocode. You can relate your actions to the instructions of a computer program.

Let us take an example of mark sheet generation of students.

What will you do before filling out individual mark sheet of students? You might be thinking to check the answer sheets. Yes, right. You will check answers of the student then you will sum up all the total of marks for every subject and then you fill that marks on mark sheet of a student.

Look at the scenario. You converted the whole process in the form of steps. You are going to follow this steps to complete the goal.

How to write an algorithm?

Our example of mark sheet generation can be converted into an algorithm as followed.

Step 1: Start

Step 2: Collecting answersheets of students.

Step 3: Checking all the answers of individual student.

Step 4: Calculating sum of all the marks.

Step 5: Filling up sum of marks on marksheet.

Step 6: calculating sum of total marks of all subject.

Step 7: Filling sum of all subject marks.

Step 8: Calculating and filling percentage of student

Step 9: End

Your first step needs to be the start and last step end. Between these two steps, you can define other steps which you are going to perform.

Now having a sequence of instructions is not enough. Sometimes you will need to repeat some process again and again. Sometimes you will need to decide to take a particular action on the basis of condition evaluated.

So an algorithm may consist of three things such as

  • Sequence
  • Iteration
  • Selection

 

 


Leave a Reply

Your email address will not be published. Required fields are marked *