Search This Blog

Blog Inauguration By : Prof. N. L. Vijaykumar, INPE - Brazil

CSE

ALGORITHM

   ALGORITHM

 Algorithms are the basic roadmaps for a coder to solving a given problem. It consists of a step of processes that lead to the solution of the problem at hand. Based on the algorithm, programmers write the code in a programming language of their choice. While some prefer a list of processes in plain English, an algorithm is usually written as what is called apseudocode

         


.

An algorithm should have the following properties:

{1}Well-defined inputs and outputs

{2}Defined steps that can be executed in a finite amount of time

{3}A clear stopping condition.

 

 

 

 

An example should make it clear:

Problem:

Printing all names stored in an array known to contain MAX number of names:

The pseudo code for the problem would be as follows:

 Counter=0;

 While (counter < MAX): Print Names[counter];

 Counter=counter+1;

    The algorithm defines a function print_names that takes two parameters: an array of names names, and the maximum number of names MAX. The function uses a while loop to repeatedly print each name in the array until the index i is no longer less than MAX. The index i is incremented by 1 after each iteration of the loop.

   There is no standard specification for writing pseudo code.Also, the procedure for solving a problem may differ from one programming language to other.


No comments:

Post a Comment