I need some clarification regarding Big O
<p>I have a few questions so please bear with me.  I need some help to clarify Big O and run time.  As I understand it Big O is a way of presenting the run time of an algorithm correct?  From reading I've been trying to figure out how to calculate the Big O of an algorithm.  So far I've figured out that something like this has a Big O of O(N^2)</p>

<pre><code>for(i = 0; i &lt; N, i++)
    for(j = 0; j &lt; N; j++)
      //code
</code></pre>

<p>But what happens if it is this:</p>

<pre><code>for(i = 0; i &lt; N, i++)
    for(j = 0; j &lt; M; j++)
      //code
</code></pre>

<p>Where N isnt always equal to M.</p>

<p>Also what is the Big O if you have two of these added together?</p>

<pre><code>for(i = 0; i &lt; N, i++)
    for(j = 0; j &lt; N; j++)
      //code
for(i = 0; i &lt; N, i++)
    for(j = 0; j &lt; N; j++)
      //code
</code></pre>

<p>Is the big O equal to N^2 + N^2 = 2N^2?</p>
