title: Time complexity in loop
body: <p>Im new with algorithmic analysis. I just want to verify mi understanding:</p>
  
  <p>For example:</p>
  
  <pre><code>for (i=0, i&lt;n; i++) {
  }
  </code></pre>
  
  <p>Is clear that there are 1 asignation, n comparations, and n incrementations.</p>
  
  <p>The n function is: T(n) = t0 + t1*n + t2*n = t0 + (t1+t2)n = c0+c1*n   </p>
  
  <p>So the complexity is: O(n)</p>
  
  <p>But, in this other cases i need some advice:</p>
  
  <pre><code>for (i=0, i&lt;=n; i++) {
  }
  </code></pre>
  
  <p>T(n) = t0 + t1*(n+1) + t2*(n+1) ???</p>
  
  <pre><code>for (i=0, i&lt;n-1; i++) {
  }
  </code></pre>
  
  <p>T(n) = t0 + t1*(n-1) + t2*(n-1) ???</p>
  
  <pre><code>for (i=1, i&lt;n; i++) {
  }
  </code></pre>
  
  <p>T(n) = t0 + t1*(n-1) + t2*(n-1) ???</p>
  
  <p>I think one would say all those fors loops are just O(n) and thats the only thing that matters. But i want to know if those T(n) definitions are ok.</p>