I'm studying the algorithm analysis of one piece of code, and I have to find the big-O notation of the sum of a sum.
$$g(n)=\sum^{n}_{i=0}\left(\sum^{n}_{j=i+1}O(1)\right)$$ $O(1)= c\times1$, thus $$g(n)=\sum^{n}_{i=0}\left[\sum^{n}_{j=i+1}(c\times 1)\right]$$
But I can't take it from here.
Any suggestion? thanks!
You can simply write $c$ instead of $(c \times 1)$, and then evaluate the sum. What kind of function of $n$ do you get?