Algorithm and
pseudo code. difference between algorithm and pseudo code.
-By Ayush garg
What is algorithm?
Definition :
It is the
stepwise representation of any problem.
Algorithm is used to represent solution of any
problem in the well defined manner. Algorithm
is the way to express the logic of any problem. It is the language independent.
It means there is no specific syntax to write the algorithm so it is not used
in the system to develop the software but is the human understandable so that
any programmer implemented it easily.
Algorithm is in the specific order of step. It means that you must write
the step in algorithm in the specific order and step must be a well defined
because programmer are implement this
algorithm to develop the software .Well specific order and well define step make it easily
understandable .It is written in the human friendly language(generally in the
English language). By using the algorithm any programmer implement it in the
high level language i.e. c, c++, java, etc.
Advantage:
For writing
the algorithm it doesn’t necessary person know programming language. It very helpful for the person who doesn’t
know the programming language, but know the solution of the problem. By using
algorithm any programmer implemented it.
But there are
some criteria for writing the algorithm:-
1. Input-
algorithm has zero or more than zero input.
2. Output-
it necessary the algorithm must give the at least one output and the output
must be a desire output.
3. Effectiveness
– each and every instruction must have importance in the algorithm.
4. Finiteness-
algorithm must be terminating at the certain point.
5. Unambiguous-
each and every instruction must have certain (specific) meaning.
It the
algorithm must follow all these criteria.
Example
Swap ():
1. Start
2. Read three number num1,num2
3. Temp=num1
4. num1=num2
5. num2=temp
6. print num1,num2
7. stop
Explanation:
The above algorithm
has input num1 and num2. Output num1 and num2. Each and every instruction is
have certain meaning and importance. And the algorithm is finite.
What is Pseudo Code?
Definition:
It is also a way of representing the solution
of the problem.
It is also
not syntax specific so it is not executable in the system. We also say that it
is another way of representing the algorithm. There is lot of format of writing
the pseudo code. Mostly borrow from the c, lips, FORTRAN etc. it is not written
in the natural language it means it is not written in the English language
(human friendly language). Pseudo code contains the code or syntax but the code
is not language specific. Only the programmer is able to understand the pseudo
code because pseudo code is close to language. It written in such format which
is close to program. Form the programmer point of view it is much easier to
convert the pseudo code into program rather than converting the algorithm into
program.
Advantage:
It is very helpful for the programmer to write
the logic in the pseudo code and by use pseudo code to create the program.
Example:
Swap (num1,
num2)
{
Temp=num1;
num1=num2;
num2=temp;
Print (num1,
num2);
}
Difference between algorithm and
pseudo code:
Algorithm
1. Each and every understand algorithm easily.
2. Write in the natural (human friendly language).
3. Only the programmer or the person know programming are able to understand pseudo code.
4. It beneficial forms the programmer point of view.
Pseudo code
1. Only the programmer or the person know programming
language understand it.
2. Write in certain code which is close to programming
language.
3. Each and every one even the person doesn’t programming
are able understand the algorithm easily.
4. It is beneficial for the person who doesn’t know the
programming.
Note-
In some book two type of algorithm are give
1. natural language.
2. pseudo code.
so don't be confuse here natural language is explained as Algorithm.
Note-
In some book two type of algorithm are give
1. natural language.
2. pseudo code.
so don't be confuse here natural language is explained as Algorithm.
If you have any suggestion related to my article please comment.
Than kyou
Comments
Post a Comment