I have the following pseudocode:
And I want to find the number of flops (floating point operations) in the code. I need to write my final answer in terms of only $n$. Since every variable in each loop is different, I am quite confused on how to reach that point. I do see that the only flop in the code is the addition in the most inner loop. This is what I could come up with:
$\sum _{i=1}^n\:\left(\sum _{j=1}^i\:n-j-1\right)$
But, this does not look correct and I am not sure how I would write it in terms of only $n$.
I would greatly appreciate any assistance!
