title: Big-Oh analysis of the running time?
body: <p>For each of the following program fragments, give a Big-Oh analysis of the running time. I have two problems that I am not 100% sure if there right, can somebody help me </p>
  
  <p>Fragment 1:</p>
  
  <pre><code>for( int  i  =  0;  i  &lt;  n;  i++ )
        for(  int  j  =  0;  j  &lt;  n  *  n;  j++ )
              for(  int  k  =  0;  k  &lt;  j;  k++ )
                   sum++;
  </code></pre>
  
  <p>Answer: O(n^5) not really sure n*n??</p>
  
  <p>Fragment 2:</p>
  
  <pre><code>for(  int  i  =  1;  i  &lt;=  n;  i++ ) 
          for(  int  j  =  1;  j  &lt;=  i  *  i;  j++ )
                               if (j % i == 0)
                     for(  int k  =  0;  k  &lt;  j;  k++)
                    sum++;
  </code></pre>
  
  <p>Answer:O(n^4)</p>