I HAVE A QUICK QUESTION. I AM NOT SURE IF I AM LOOKING AT OR SOLVING THIS QUESTION RIGHT.
IF YOU HAVE
for(i=1, i<=n, i++)
for(int j=1, j<=i, j++)
for(int k=1, k<=5, k++)
TASK T
1: for the k loop i take the summation of i=1 to 5 of Tsubi to get (5xT)
2: for the j loop i take the summation of i=1 to n of 5xTsubi to get n(5xT)
3: for the i loop i take the summation of i=1 to n of(n*5)xTsubi to get
(n*5)*n*T
or do i solve like this
1: for the k loop summation k=1 to 5 of Tsubk to get 5xT
2: for the j loop summation of j=1 to i of 5*Tsubj to get 5*i*T
3: for the i loop summation of i=1 to n of 5*i*Tsubi to get (n*5)T*(1+2+3+4....+n)
also you can see in the first one i took all the summation in terms of Tsubi and in the second example i took the summations in terms of the variable in the loop. which way is correct. any hints or tricks on how to look and analyze future algorithms also would be great thanks again.