title: How to calculate worst case analysis of this algorithm?
body: <pre><code>sum = 0;
  for(int i = 0; i &lt; N; i++)
      for(int j = i; j &gt;= 0; j--)
         sum++;
  </code></pre>
  
  <p>From what I understand, the first line is 1 operation, 2nd line is <code>(i+1)</code> operations, 3rd line is <code>(i-1)</code> operations, and 4th line is <code>n</code> operations.  Does this mean that the running time would be <code>1 + (i+1)(i-1) + n</code>?  It's just these last steps that confuse me.</p>