Design And Analysis of Algorithms






Definition:
An algorithm is a finite set of instructions that, if followed, accomplishes a particular task.
In addition, all algorithms must satisfy the following criteria:
• Input. Zero or more quantities are externally supplied.
• Output. At least one quantity is produced.
• Definiteness. Each instruction is clear and unambiguous.
• Finiteness. The algorithm terminates after a finite number of steps.
• Effectiveness. Every instruction must be very basic enough and must be feasible.

Algorithm Definition: 
• An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate input in a finite amount of time. 
• Algorithms that are definite and effective are also called computational procedures.
 • A program is the expression of an algorithm in a programming language.


We can describe an algorithm in many ways.
 1. Natural language: use a natural language like English
 2.Flow charts: Graphic representations called flowcharts, only if the algorithm is small and simple. 3.Pseudo-code: also avoids most issues of ambiguity; no particularity on syntax programming language

What is Algorithm Specification:
Comments begin with // and continue until the end of line.
2. Blocks are indented with matching braces {&}.Compound statement can be  represented as a block.statements delimted by ;
3.identifier begins with a letter.
   The data types of variables whether it is local or global based on context.
   compound data types can be formed with records.
node=record
   {
            datatype_1 data1;
            datatype_n   datan;
            node *link;
   }

4.Assignment of values to variables done using assignment statement;
<variable>:=<expression>;
 

}

Comments