title: Can Someone please explain me the logic of calculating big-O in my example
body: <p>It is said the complexity of selection sort is O(N^2) but i don't get the logic since i'm reducing the number of times the loop executed. I understand for Code block 2 but not for code block 1</p>
  
  <pre><code>public int[] Sorting(int[] array)
  {
      for (i = 0; i &lt;= array.Length - 1; i++)
      {           
          minimum=i;
          for (j = i; j &lt; array.Length-1; j++) 
          {
              if (array[minimum] &gt; array[j+1])
                  minimum = j + 1;
          }   
          int temp = array[minimum];
          array[minimum] = array[i];
          array[i] = temp;
      }
  
      return array;
  }
  </code></pre>
  
  <hr>
  
  <pre><code>for(i=0;i&lt;=n;i++) //Code 2
  {
      for(j=0;j&lt;=n;j++)
  </code></pre>