How To Write Algorithm Steps.
Hello, Programmer, we all know that Programming is the art of Algorithm Design. So before knowing How To Write Algorithm Steps, we must know what is Algorithm.
What is an Algorithm:-
An algorithm is a procedure which follows by computer to solve a problem. It is a step by step procedure to solve any problem or reach a goal. We have all seen food recipes likey they list them all ingredients needed and a set of steps for how to make the described meal. Well, an algorithm is just like that. In computer language, the recipe is a procedure, and the ingredients are called inputs. Your computer follows your procedure and gives you the results, which are called outputs.
An algorithm just describes how to do something. An algorithm is not computer code it's written in simple English. It always leads to a solution and tries to be the most efficient solution we can think up.
Example of Algorithm:
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP
//WRITE AN ALGORITHM TO FIND THE AREA OF RECTANGLE.
STEP 1: START
STEP 2: ACCEPT THE W OF RECTANGLE
STEP 3: ACCEPT THE H OF RECTANGLE
STEP 4: Area = w × h
STEP 5: DISPLAY
STEP 6: STOP
Once you have a solid idea of what you're aiming to accomplish, you can determine the steps it will take to get there.
For example:- If you want to write an algorithm for the sum of two number you should know which type of input you will give integer or float type and what type of result you get.
2) Decide On a Starting Point: Finding your starting point is crucial to list the steps of the process. You should know where to start. If you know where to start you can be listing all steps easily and listing steps in the right way are helping to achieve your goal for which you have written that algorithm.
For Example: If you want to write an algorithm for the sum of two number then you should know your starting point.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START // Starting Point
STEP 2: ACCEPT the FIRST NUMBER
If you know where to start then it is easy to list all remaining steps.
3) Find the Ending Point: Your algorithm must end at some point otherwise it will be incomplete. You should know where to stop.
If you don't know your ending point your algorithm is incomplete and that type of algorithm is useless. So if you want to write an algorithm which helps you to solve a specific problem you must have an ending point in your algorithm.
For Example: If you want to write an algorithm for the sum of two number then your algorithm must end at some point.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
4) List All The Steps: From the starting point with the inputs, list every small required step to achieve the ending point and the output. If you have clear know where to start then list other steps and write your algorithm.
For Example: If you know where to start means you know your starting point then list other steps and write your algorithm.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START //Starting Point
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
5) Review the Algorithm: It's time to evaluate the process.
Consider all special cases and make sure your algorithm accomplishes the correct output.
For Example: If you have written an algorithm for the sum of two number then it's time to review your algorithm.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START //Starting Point
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
Consider all special cases and make sure your algorithm accomplishes the correct output.
Comment and tell me is it useful information for You...
Share it...
An algorithm just describes how to do something. An algorithm is not computer code it's written in simple English. It always leads to a solution and tries to be the most efficient solution we can think up.
Example of Algorithm:
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP
//WRITE AN ALGORITHM TO FIND THE AREA OF RECTANGLE.
STEP 1: START
STEP 2: ACCEPT THE W OF RECTANGLE
STEP 3: ACCEPT THE H OF RECTANGLE
STEP 4: Area = w × h
STEP 5: DISPLAY
STEP 6: STOP
Steps To Write An Algorithm:
1) Determine The Input/Output: This step is much more difficult and important steps. Firstly you should clear about what type of input you want to give and what type of output you want. If you are not clear which type of input you want to give and what type of output you want then you will never able to write a better algorithm.
Once you have a solid idea of what you're aiming to accomplish, you can determine the steps it will take to get there.
For example:- If you want to write an algorithm for the sum of two number you should know which type of input you will give integer or float type and what type of result you get.
For Example: If you want to write an algorithm for the sum of two number then you should know your starting point.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START // Starting Point
STEP 2: ACCEPT the FIRST NUMBER
If you know where to start then it is easy to list all remaining steps.
3) Find the Ending Point: Your algorithm must end at some point otherwise it will be incomplete. You should know where to stop.
If you don't know your ending point your algorithm is incomplete and that type of algorithm is useless. So if you want to write an algorithm which helps you to solve a specific problem you must have an ending point in your algorithm.
For Example: If you want to write an algorithm for the sum of two number then your algorithm must end at some point.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
4) List All The Steps: From the starting point with the inputs, list every small required step to achieve the ending point and the output. If you have clear know where to start then list other steps and write your algorithm.
For Example: If you know where to start means you know your starting point then list other steps and write your algorithm.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START //Starting Point
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
5) Review the Algorithm: It's time to evaluate the process.
Consider all special cases and make sure your algorithm accomplishes the correct output.
For Example: If you have written an algorithm for the sum of two number then it's time to review your algorithm.
//WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS.
STEP 1: START //Starting Point
STEP 2: ACCEPT the FIRST NUMBER
STEP 3: ACCEPT the SECOND NUMBER
STEP 4: ADD THESE TWO NUMBERS
STEP 5: DISPLAY RESULT
STEP 6: STOP //Ending Point
Consider all special cases and make sure your algorithm accomplishes the correct output.
Comment and tell me is it useful information for You...
Share it...
Heyy, I completed my engineering degree 5 years back. Since then, I have been quite out of touch with coding and everything else. So, this post made me feel quite nostalgic. And it is a very simple and to the point post. Keep up the good work.
ReplyDelete