title: What will be the time complexity of this algorithm
body: <p>I am very new to competitive programming and to Big O notation.</p>
  <pre><code>public void function(int n){
     for(int i = n; i &gt; 0; i/=3){
         for(int j = 0; j &lt; i; j++){
             System.out.println(&quot;Hello&quot;);
         }
     }
  }
  </code></pre>
  <p>This is the algorithm.
  As far as i know about time complexity.It defines how run time gets affected from number of inputs.</p>
  <p>So here if we take a example
  if 'n' is 10.
  The outer loop runs log n times and the inner loop runs 'i' times.</p>
  <p>the inner loop runs relatively to 'i' not 'n'.
  So im a bit confused here as to how the time complexity is calculated.
  I think it is O(log n).Please correct me if i am wrong.</p>
  <p>Will it be O(log n) or O (n log n) or (n^2).
  Please help me out with this.
  Thank you.</p>