Tag: Time Complexity

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 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 →