What is the time complexity of the following function given
What is the time complexity of the following function, given that the time complexity of f unc() = M, f unc 2() = c, where \'c\' is a constant. int j, k; for (j = 1; j j; k=k-1) func2();}
Solution
int j,k;
for(j=1;j<=M;j++)
{
func();
for(k=M;k>j;k=k-1)
func2();
}
the time complexity of the func()=M is m+1 and func2()=c is (m+1)*m
