As the title says I am trying to understand how to work through this problem.
for (i=1; i<=n; i++) {
for (j=n; j>=1; j--) {
for (k=1; k<=i+j; k++) {
<some-constant number of atomic/elementary operations>
}
}
}
As much as I understand it should start something like this
$$ T(n) = \sum_{i=1}^{n} \sum_{j=n}^{1} \sum_{k=1}^{i+j} c $$
However, I am pretty sure it is not correct because j is decreasing, and I'm not sure how to represent that.
I am also curious about whether or not ≤ ≥ and < > change how things are represented in summation.
An answer to my issue would be nice but more than that I am hoping to gain an understanding of how to solve it properly on my own. A nudge in the right direction would be most appreciated.
It doesn't matter which way around you write the sums, the important thing is being able to resolve what they add to.
As for the difference between $<$ and $\leq$, the difference is one value, so you just need to make sure that your sum covers all (and only) the values that the loop actually iterates over.
As for calculating the sum, in this case it's pretty easy since the value being summed is constant, so $\sum_{k = 1}^{i + j} c = c(i + j)$ and those indices don't depend on each other so you can separate their sums.