Professional Documents
Culture Documents
Complexity Analysis.
Algorithm Analysis
Apriori Analysis - Its the theoretical analysis,
the efficiency of the algorithm is calculated
theoretically like processing speed , machine
specification and have no effect on
implementation.
A posterior Analysis Its an emperical analysis,
ie running the program in the target machine
and find the efficiency by running time , space
needed.
Complexity
X algorithm
n Size of input
Time Factor measured by counting the number of
key
operation
Space Factor tell the space required to execute
the Alg.
Fixed part.
Variable part.
RECURSION
Some computer programming languages allow a
module or function to call itself.
A function a call itself.
Call b that it call a.
Then the function a is called recursive function.
eg , function call itself.
int function (int value)
{
if (value<1)
return;
function(value-1);
printf(%d, value);
}
Properties
Recursion function can go infinite like loop.
To avoid
Base criteria Giving a condition so that the
given
condition is met, the function stops
calling itself.
Progressive Approach the recursive call
should
progress in such a way the each time
a recursive call is made it come
closer
closer to the base criteria.
Implementation Many programming languages
implement
recursion by means of stacks.
whenever a function(caller) calls another
function(callee). The caller function transfers
execution control to the callee.
Analysis of recursion Time complexity
Space complexity