## What is the time complexity of, f(n)= n3+n2+n+4

What is the time complexity of given function,f(n)= n3+n2+n+4 ? Solution: Given, f(n)= n3+n2+n+4 f(n) >= n3+n2+n+4  f(n) >= n3+n2+n, for all n>=1 f(n) >= n3+n2 , for all n>=1 f(n) >= n3, for all n>=1 Compare with the standard Big omega notation equation that is,  f(n)>=c*g(n), for all n0>=n Here, g(n) = n3,  c = 1 n0 = 1 f(n) = Ω(g(n)) f(n) = […]

## What is the time complexity of, f(n)= n+4

What is the time complexity of given function? f(n)=n+4. Solution: Given, f(n)=n+4  n+4 >= n+4 n+4 >= n, where n >= 1 n+4 >= n, for all n>=1 f(n) >= n, for all n>=1 Compare with the standard Big omega notation equation that is, f(n) >= c*g(n), for all n0>=n Here, g(n) = n,  c = 1 […]

## What is the time complexity of, f(n)= 5n2+3n+4

What is the time complexity of given function, f(n)= 5n2+3n+4 ? Solution:  Given,  f(n)=5n2 +3n+4  5n2 +3n+4>=5n2 +3n+4 for all n>=1 5n2 +3n+4>= 5n2 +3n for all n>=1 5n2 +2n+4>=5n2 for all n>=1 f(n)>=5n2 for all n>=1 Compare with the standard Big omega notation equation that is,  f(n)>=c*g(n) for all n0>=n So here c =5, g(n)=n2 and n0 =1 f(n)=Ω(g(n))  f(n)=Ω(n2)

## Find the time complexity of sum of two matrices

What is the time complexity of the program for the sum of two matrices? Step count method void sum() { int n, a[n][n],b[n][n],c[n][n],i,j; //—-0  for(i=0;i<n;i++) //—-n+1   {      for(j=0;j<n;j++) //—-n+1       {         c[i][j]=a[i][j]+b[i][j]; //—-n        }   } } f(n) = 0 + (n+1) * (n+1+n) f(n) = (n+1)*(2n+1) f(n) =  2n2 + 3n + 1 f(n) = O(n2)

## Find the time complexity of sum of two numbers using function

What is the time complexity of the program for the sum of two numbers using function ? Step count method int sum()  { int a,b,c; // —-0 a=10; //—-1 b=20; //—-1 c=a+b; //—-1 return c; //—-1 } f(n) = 0+1+1+1+1 = 4 f(n) = O(1)

## Find the time complexity of sum of two numbers

What is the time complexity of the program for the sum of two numbers ? Step count method void main()  { int a,b,c; //———-0 a=10; //———-1 b=20; //———-1 c=a+b; //———-1 } f(n) = 0+1+1+1 = 3 f(n) = O(1)