How to determine Big O performance by looking at for loops?
<p>I have just begun learning about Big O Notation and honestly I don't think I have the hang of it, and I am not quite sure how to determine the O() performance by just looking at for loops. I have listed a few examples and then some of the answers that I think are correct! Please let me know if they are wrong and any explanations would be greatly appreciated!</p>

<pre><code>for (int i = 0; i &lt;1000; i++) {
        count ++;
</code></pre>

<p>I believe this would be O(n), because nothing else is going on in the for loop except constant time printing. We iterate 'n' times, or in this case 1000?</p>

<pre><code>for (int i = 0; i &lt; n; i++) {
    for(int j = 0; j &lt; n; j++)
       count ++;
</code></pre>

<p>Would this one have an O(n^2) because the loops are nested and it iterates n twice, n*n?</p>

<pre><code>for (int i = 0; i &lt; n; i++) {
    for( int j = i; j &lt; n; j++)
       count++;
</code></pre>

<p>Is this one another O(n^2) but in the worst case? Or is this O(n log n)?</p>