title: Complexity Time O(n) or O(n(n+1)/2)
body: <p>What the complexity of algorithm that loops on n items (like array) then on (n-1) then (n-2)and so on Like:</p>
  
  <pre><code>Loop(int[] array) {
    for (int i=0; i&lt;array.Length; i++) {
       //do some thing
  
    }
  }
  Main() {
     Loop({1, 2, 3, 4}); 
     Loop({1, 2, 3}); 
     Loop({1, 2}); 
     Loop({1}); 
  //What the complexity of this code.
  }
  </code></pre>
  
  <p>What is the complexity of the previous program?</p>