title: Count amount of times loop runs (Big O)
body: <p>I'm given a pseodocode statement as such:</p>
  
  <pre><code>function testFunc(B)
    for j=1 to B.length-1
       for i=1 to B.length-j
         if(B[i-1] &gt; B[i]
           swap B[i-1] and B[i]
  </code></pre>
  
  <p>And I'm told to show that this algorithm runs in <code>Big o O(n^2) time</code>.</p>
  
  <p>So I know that the first for loop  runs <code>n</code> times, because I believe it's inclusive. I'm not sure about the rest of the lines though, would the second for loop run <code>n-2</code> times? Any help would be much appreciated.</p>