written 8.3 years ago by |
Algorithm is the collection of simple instructions for carrying out a task.
Algorithm can also be considered as sequence of unique instructions for solving a specific problem.
That is whatever the size of input data is; the algorithm can solve the given problem in finite amount of time.
An algorithm is translated into flow charts and then into source codes for implementation of the system.
Steps:
Steps of defining an algorithm is shown below in figure 2.
It includes:
Defining your algorithm input.
Defining variables.
Outlining the algorithm operations.
Output the result of your algorithm operations.
Include special cases if any present.
Developing an algorithm in pseudo code form:
The algorithm should always begin with the statement “START” and end with the statement “STOP”.
To accept the input form user we will use “INPUT” or “READ” statement.
To display the output on monitor, we will use “PRINT” statement.
We will use the basic arithmetic operators to indicate the operations.
We will use “AND”, “OR” and “NOT” to indicate conjunction, disjunction and negation respectively.
To check conditions we can use the “IF”, “THEN” and “ELSE” constructs.
To branch form one step to another step the construct used is “GOTO”.