title: How to calculate Time Complexity for a given algorithm
body: <p>i, j, N, sum is all integer type. N is input.</p>
  
  <p>( Code1 )</p>
  
  <pre><code>i = N;
  
  while(i &gt; 1)
  {
      i = i / 2;
      for (j = 0; j &lt; 1000000; j++)
      {
         sum = sum + j;
      }
  }
  </code></pre>
  
  <p>( Code2 )</p>
  
  <pre><code>sum = 0;
  d = 1;
  d = d &lt;&lt; (N-1);
  for (i = 0; i &lt; d; i++)
  {
      for (j = 0; j &lt; 1000000; j++)
      {
          sum = sum + i;
      }
  }
  </code></pre>
  
  <p>How to calculate step count and time complexity for a Code1, Code2?</p>