title: Big O of duplicate check function
body: <p>I would like to know exactly how to compute the big O of the second while when the number of repetitions keeps going down over time.    </p>
  
  <pre><code>int duplicate_check(int a[], int n) 
       {
        int i = n; 
         while (i &gt; 0) 
         {
            i--; 
            int j = i - 1; 
           while (j &gt;= 0) 
            { 
              if (a[i] == a[j]) 
                 { 
                   return 1; 
  
                 } 
  
             j--; 
            } 
          }
      return 0; 
  }
  </code></pre>