title: TIme complexity of various nested for loops
body: <p>Time Complexity of a loop is considered as O(Logn) if the loop variables is divided / multiplied by a constant amount.</p>
  
  <p>loop 1 ----</p>
  
  <pre><code> for (int i = 1; i &lt;=n; i *= c) 
  {
     // some O(1) expressions
  }
  </code></pre>
  
  <p>loop 2 -----</p>
  
  <pre><code>  for (int i = n; i &gt; 0; i /= c) 
   {
     // some O(1) expressions
   }
  </code></pre>
  
  <p>Time Complexity of a loop is considered as O(LogLogn) if the loop variables is reduced / increased exponentially by a constant amount.</p>
  
  <pre><code>Here c is a constant greater than 1   
  </code></pre>
  
  <p>loop 3 ----</p>
  
  <pre><code>for (int i = 2; i &lt;=n; i = pow(i, c)) 
  { 
      // some O(1) expressions
  }
  </code></pre>
  
  <p>loop 4 -----</p>
  
  <pre><code> ////Here fun is sqrt or cuberoot or any other constant root
   for (int i = n; i &gt; 0; i = fun(i)) 
  { 
     // some O(1) expressions
  }
  </code></pre>
  
  <p>Can anyone explain me why it is by considering the number of times the inner loop executes in these loops?</p>
  
  <p>If c=1 in loop 1 and loop 2 then it will run infinite times right but it is given as logarithimic time why?</p>
  
  <p>how is it O(loglogN) in loop 3 and loop 4?</p>