title: Doubts about the complexity of a nested loop
body: <p>I have a doubt on my answer about the complexity of this inner loop:</p>
  <pre><code>for(i=0;i&lt;n;i++){
          for(j=i+1;j&lt;n;j++)
  </code></pre>
  <p>The first loop will iterate n-1 times and I believe the inner loop should iterate (n-1)*(n-1-j) times.</p>
  <p>In the worst case there should always be less than n^2 iterations but more than n iterations,
  so I'm not sure if the compexity is O(n) or O(n^2). My answer would be O(n^2) but I'm not sure.</p>