Ques : Describe Pseudo – Code for Algorithm

, , No Comments

Pseudo-code (derived from pseudo-code) is a compact and informal high level description of a computer programming algorithm that uses the structural conventions of some programming language. Unlike actual

computer language such as C,C++ or JAVA, Pseudo-code typically omits details that are not essential for understanding the algorithm, such as functions (or subroutines), variable declaration, semicolons, special words and so on. Any version of pseudo-code is acceptable as long as its instructions are unambiguous and is resembles in form. Pseudo-code is independent of any programming language. Pseudo-code cannot be compiled nor executed,
and not following any syntax rules.

Flow charts can be thought of as a graphical alternative to pseudo-code. A flowchart is a schematic representation of an algorithm, or the step-by-step solution of a problem, using some geometric figures (called flowchart symbols) connected by flow-lines for the purpose of designing or documenting a program.

The purpose of using pseudo-code is that it may be easier to read than conventional programming languages that enables (or helps) the programmers to concentrate on the algorithms without worrying about all the syntactic
details of a particular programming language. In fact, one can write a pseudocode for any given problem without even knowing what programming language one will use for the final implementation.

Example: The following pseudo-code “finds the maximum of three numbers”.

Input parameters : a , b , c
Output parameter : x

Find Max (a,b,c,x)

{
x=a
if (b>x) / if b is larger than x then update x
x=b
if (c>x) / if b is larger than x then update x
x=c
}

The first line of a function consists of the name of the function followed parentheses, in parentheses we pass the parameters of the function. The parameters may be data, variables, arrays, and so on, that are available to the
function. In the above algorithm, The parameters are the three input values, a,b, and c and the output parameter, , that is assigned the maximum of the three input values a,b, and c

0 टिप्पणियाँ:

Post a Comment