title: Simple Algorithm time complexity Question
body: <p>I am working on an assignment for an intro Datamining course.  I am trying to figure out the time complexity of an algorithm (see below)? Is it linear/exponential/log/quadratic/polynominal?  Any tips on how to approach a question like this would be much appreciated</p>
  
  <p>Consider the following algorithm for finding the third smallest element in
  an array:</p>
  
  <ul>
  <li>Input: <code>n, a[1..n]</code> - array a of numbers, and n is its size, n>=3</li>
  <li>Output: - return 3rd smallest number</li>
  <li>Temporary variables: <code>b[1..3], t, i</code></li>
  </ul>
  
  <p>Code:</p>
  
  <pre><code>b[1] = a[1]
  b[2] = a[2]
  if b[1] &gt; b[2] then t=b[1]; b[1]=b[2];  b[2]=t
  b[3] = a[3]
  if b[2] &gt; b[3] then t=b[2]; b[2]=b[3]; b[3]=t
  if b[1] &gt; b[2] then t=b[1]; b[1]=b[2]; b[2]=t
  for (i = 4; i &lt;= n; i = i+1)
    if a[i] &lt; b[3] then b[3] = a[i]
    if b[2] &gt; b[3] then t=b[2]; b[2]=b[3]; b[3]=t
    if b[1] &gt; b[2] then t=b[1]; b[1]=b[2]; b[2]=t
  return b[3]
  </code></pre>