DAA UNIT 1
DAA UNIT 1
Input: there are zero or more quantities, which are externally supplied;
Finiteness: if we trace out the instructions of an algorithm, then for all cases the algorithm will
terminate after a finite number of steps;
Effectiveness: every instruction must be sufficiently basic that it can in principle be carried out
by a person using only pencil and paper. It is not enough that each operation be definite, but it
must also be feasible.
Until<condition>
Case
{
<cond 1>: <stmt 1>
.
.
.
<con n>: <stmt n>
9. Input and output are done using the instructions read &write.
10. There is only one type of procedure: Algorithm, the heading takes the form,
Example:
Performance Analysis:
The performance of a program is the amount of computer memory and time needed to run a
program. We use two approaches to determine the performance of a program. One is analytical,
and the other experimental. In performance analysis we use analytical methods, while in
performance measurement we conduct experiments.
Time Complexity:
The time needed by an algorithm expressed as a function of the size of a problem is called the
time complexity of the algorithm. The time complexity of a program is the amount of computer
time it needs to run to completion.
The limiting behavior of the complexity as size increases is called the asymptotic time
complexity. It is the asymptotic complexity of an algorithm, which ultimately determines the size
of problems that can be solved by the algorithm.
Data space:
Data space is the space needed to store all constant and variable values. Data space has
two components:
1. Space needed by constants and simple variables in program.
2. Space needed by dynamically allocated objects such as arrays and class instances.
Environment stack space: The environment stack is used to save information needed to
resume execution of partially completed functions.
Instruction Space: The amount of instructions space that is needed depends on factors
such as:
The compiler used to complete the program into machine code.
The compiler options in effect at the time of compilation
The target computer.
The space requirement s(p) of any algorithm p may therefore be written as,
S (P) = c+ Sp (Instance characteristics)
Where c‟ is a constant.