 uses Heap Sort.  It runs in constant
   stack space.
</p><p>

   Specification of the comparison function:
   Let <code class="code">a</code> be the array and <code class="code">cmp</code> the comparison function.  The following
   must be true for all x, y, z in a :</p><ul>
<li>  <code class="code">cmp x y</code> &gt; 0 if and only if <code class="code">cmp y x</code> &lt; 0</li>
<li>  if <code class="code">cmp x y</code> &gt;= 0 and <code class="code">cmp y z</code> &gt;= 0 then <code class="code">cmp x 