1. Describe in detail about algorithm? Give example (MAY 2009)
An algorithm is a description of a procedure which terminates with a result. Simple algorithms can be implemented within a function.
Properties of an algorithm
No ambiguity
There should not be any uncertainty about which instruction to execute next. The algorithm should conclude after a finite number of steps.
The algorithm should be general.
Example:
Biggest among two numbers Addition of N numbers Finding Factorial of a number Finding Fibonacci series.
4. Elaborate pseudo code with example. (MAY 2009\FEB 2009)
Guidelines
Statements should be in simple English
Must produce a solution for the specified problem
It should be concise
Each instruction should be written in separate line and express one action. Capitalize keywords such as READ, PRINT and so on.
Instruction should be written from top to bottom, with one entry and one exit. Should allow easy transition from design to coding in programming language.
Benefits:
Language Independent.
Easy to develop a program from pseudo code than flowchart. Easy to translate into programming language.
It is compact.
Limitations:
No visual representation of program logic
No accepted standards for writing pseudo codes. Cannot be compiled or executed.
No real form or syntax rules.
Examples:
Finding a number is prime or not
An algorithm is a description of a procedure which terminates with a result. Simple algorithms can be implemented within a function.
Properties of an algorithm
No ambiguity
There should not be any uncertainty about which instruction to execute next. The algorithm should conclude after a finite number of steps.
The algorithm should be general.
Example:
Biggest among two numbers Addition of N numbers Finding Factorial of a number Finding Fibonacci series.
4. Elaborate pseudo code with example. (MAY 2009\FEB 2009)
Guidelines
Statements should be in simple English
Must produce a solution for the specified problem
It should be concise
Each instruction should be written in separate line and express one action. Capitalize keywords such as READ, PRINT and so on.
Instruction should be written from top to bottom, with one entry and one exit. Should allow easy transition from design to coding in programming language.
Benefits:
Language Independent.
Easy to develop a program from pseudo code than flowchart. Easy to translate into programming language.
It is compact.
Limitations:
No visual representation of program logic
No accepted standards for writing pseudo codes. Cannot be compiled or executed.
No real form or syntax rules.
Examples:
Finding a number is prime or not
No comments:
Post a Comment