DAA_UNIT1
DAA_UNIT1
UNIT-I
By
Dr.M.Rajababu
Associate Professor&HoD
Dept of Information Technology
Aditya University
Surampalem.
Algorithm
• An algorithm is a finite set of instructions that, if followed, accomplishes a particular task.
• All algorithms must satisfy the following criteria:
• Input
-An algorithm has zero or more inputs, taken from a specified set of objects.
• Output
-An algorithm has one or more outputs, which have a specified relation to the inputs.
• Definiteness
-Each step must be precisely defined; Each instruction is clear and unambiguous.
• Finiteness
-The algorithm must always terminate after a finite number of steps.
• Effectiveness
-All operations to be performed must be sufficiently basic that they can be done exactly and in finite
length.
Design&analysisof Algorithms M.Raja Babu Thursday, December 5, 2024
Design&analysisof Algorithms M.Raja Babu Thursday, December 5, 2024
Algorithm specification
• Algorithms can be specified in the following three ways:
• 1.using a natural language like English
• 2.using pseudo code
• 3.flow chart
• An algorithm is a step-by-step procedure or formula for solving a
problem.
• Pseudocode uses a combination of natural language and programming
language-like syntax to describe the steps of an algorithm.
It is independent of language of compiler and types of It is dependent on language of compiler and type of
hardware. hardware.
It uses the asymptotic notations to represent how much time It doesn’t use asymptotic notations to represent the time
the algorithm will take in order to complete its execution. complexity of an algorithm.
It is same for every system. posteriori analysis differ from system to system.
=n , otherwise
Input : A = Input : A =
11 111
11 111
B= 111
11 B=
11 111
C= 111
22 111
22 C=
Output : Yes 333
C=AxB 312
333
Output : No
Design&analysisof Algorithms Dr.M.Raja Babu Thursday, December 5, 2024