What is the time complexity of given function,f(n)= n3+n2+n+4 ?Solution:Given,f(n)= n3+n2+n+4f(n) >= n3+n2+n+4 f(n) >= n3+n2+n, for all n>=1f(n) >= n3+n2 , for all n>=1f(n) >= n3, for all n>=1Compare with the…
Read more →What is the time complexity of given function? f(n)=n+4.Solution:Given,f(n)=n+4 n+4 >= n+4n+4 >= n, where n >= 1n+4 >= n, for all n>=1f(n) >=…
Read more →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>=15n2 +3n+4>= 5n2 +3n for all n>=15n2 +2n+4>=5n2 for all n>=1f(n)>=5n2 for all n>=1Compare with…
Read more →What is the time complexity of the program for the sum of two matrices?Step count methodvoid 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)…
Read more →What is the time complexity of the program for the sum of two numbers using function ?Step count methodint sum() {int a,b,c; // ----0a=10; //----1b=20; //----1c=a+b; //----1return c; //----1}f(n) = 0+1+1+1+1 =…
Read more →What is the time complexity of the program for the sum of two numbers ?Step count methodvoid main() {int a,b,c; //----------0a=10; //----------1b=20; //----------1c=a+b; //----------1}f(n) = 0+1+1+1 = 3f(n) = O(1)
Read more →