title: The smallest, largest and average of array of n size
body: <p>The interview question was something like this:</p>
  
  <p>Given an array of some numbers <code>n</code> how will you find the <code>smallest</code> <code>largest</code> and the <code>average</code>?</p>
  
  <p>The answer that I made was <code>sorting the elements of the array</code> and the <code>first</code> element would be the <code>smallest</code> and <code>last</code> would be the <code>largest</code>.</p>
  
  <p>But I was told by the interviewer that sorting (assuming it takes <code>O(n)</code> , to find average it might take again <code>O(n)</code>). And she added that <code>she wanted a solution without sorting</code>.</p>
  
  <p>Any ideas how to do this in <code>optimally?</code> . Is there any pre defined algorithm that applies to this case?</p>
  
  <p>(Though I am comfortable with any <code>C</code>/<code>C++</code>/<code>Java</code> answers or even <code>pseudo codes</code>, any answers in <strong><em><code>C#</code></em></strong> is much appreciated).</p>