I want to find the time complexity of the following code but I'm not sure if I am doing it right. Printf is the basic process.Is time complexity of printf changing due to i*j or i*k
?
i=0; //c1
while (i<n){ //c2*(n+1)
for(j=i; j<n; j++) // c3*n*(n+1)
printf("The product of %d and %d is %d\n",i,j,i*j); //c4*n*n
for(k=n; k>i; k--) //c5*n*(n-1)
printf("The product of %d and %d is %d\n",i,k,i*k); //c6*n*n
i++; //c7*n
}
so the time complexity= c1+c2*(n+1)+c3*(n^2 +n)+c4*n^2 + c5*(n^2 -n)+c6*n^2 +c7*n=c8*n^2 +c9*n +c10