PLDT

Algorithm Q.Define algorithm and state properties of it?
Algorithm is a finite set of instructions that,if followed accomplishes a particular task.

Algorithm should satisfy the following criteria:-
1.Input:Zero or more quantities are externally supplied.
2.Output:At least one quantity is produced.
3.Definiteness:Each instruction is clear and unambiguous.Ex.:Add B or C to A.
4.Finiteness:Algorithm should terminate after finite number of steps when traced in all cases.Ex.:Go on adding elements to an array.
5.Effectiveness:Every instruction must be basic i.e.,it can be carried out,by a person using pencil and paper

Algorithm must also be general to deal with any situation. ALGORITHM
     Algorithm
Advantages of algorithm:-
1.It provides the core solution to a given problem.The solution can be implemented on a computer system using any programming language of user's choice.
2.It facilitates program development by acting as a design document or a blue print of a given problem solution.
3.It ensures easy comprehension of a problem solution as compared to an equivalent computer program.
4.It eases identification and removal of logical errors in a program.
5.It facilitates algorithm analysis to find out the most efficient solution to a given problem.

Disadvantages of algorithm:-
1.In large algorithms the flow of program control becomes difficult to track.
2.Algorithms lack visual representation of programming constructs like flowchart;thus understanding the logic becomes relatively difficult.

No comments:

Post a Comment