•Algorithm types:
Iterative algorithms
Recursive Algorithms
Running time f(n) of non iterative and non
recursive algorithms is always constant. Hence
f(n) = O(1)
•Fn()
{
int i
for( i = 1 to n)
print(“VIT”)
}
Running Time : O(n)
•Fn()
{
int i,j
for(i = 1 to n) n times
for(j= 1 to n) n times
print(“VIT”)
}
Running time f(n) = O (n
2
)