title: Time Complexity single loop vs multiple sequential loops
body: <p>Today, me and my colleague had a small argument about one particular code snippet. The code looks something like this. At least, this is what he imagined it to be.</p>
  <pre><code>for(int i = 0; i &lt; n; i++) {
      // Some operations here
  }
  
  for (int i = 0; i &lt; m; i++) { // m is always small
      // Some more operations here
  }
  </code></pre>
  <p>He wanted me to remove the second loop, since it would cause performance issues.</p>
  <p>However, I was sure that since I don't have any nested loops here, the complexity will always be <strong>O(n)</strong>, no matter how many sequential loops I put (only 2 we had).</p>
  <p>His argument was that if <code>n</code> is 1,000,000 and the loop takes 5 seconds, my code will take 10 seconds, since it has 2 for loops. I was confused after this statement.</p>
  <p>What I remember from my DSA lessons is that we ignore such constants while calculating Big Oh.</p>
  <p>What am I missing here?</p>