I have two interesting
programs
And I just couldn't figure out the time complexity.
The first one:
for(i = 0; i < N; i++)
for(j = 0; j < i * i; j++)
for(k = 0; k < j; k ++)
sum ++;
for(i = 1; i < N; i++)
for(j = 1; j < i * i; j++)
if(j %i == 0)
for(k = 0; k < j; k++)
These two have been troubling me for hours. My answer for the first one is O(n^5), and the second one is O(n^3). I don't know if I am correct.
Update: The answer to the second question is linked at the top of this page. Here is the solution to the first one: Computation Process