&gt; If the current comparision shows a smaller value, we update smallestSoFar.<p><pre><code>  if ( a[smallestSoFar] &gt; a[nextToCheck] ) {

</code></pre>
This code makes me twitch.  Finding a smaller value by checking to see if the old value is larger than the new value... Instead of checking to see if the new value is smaller than the old value.<p>Additionally, calling the value you are <i>currently</i> checking &#x27;nextToCheck&#x27; is also confusing.  It&#x27;s not the next one, it&#x27;s the current one.