Big O notation for Following Loops : <p>What will be the Big Oh of these portion of codes: </p>

<pre><code>int sum = 0;

for(int i = 1; i &lt; N; i *= 2)

for(int j =0; j &lt;i; j++)

sum++;
</code></pre>

<p>And</p>

<pre><code>int sum = 0;

for(int i = 0; i &lt; N; i *= 2)

for(int j =0; j &lt;i; j++)

sum++;
</code></pre>

<p>My Attempt:
According to me both have time complexity equal to O(n^2), because here we will multiply n with n which is equal to n^2. Am I correct? Or doing some mistake?</p>
