title: Heap sort pseudo code algorithm
body: <p>In heap sort algorithm   </p>
  
  <pre><code>n=m
  for k:= m div 2 down to 0
      downheap(k);
  repeat
      t:=a[0]
      a[0]:=a[n-1]
      a[n-1]:=t
      n—
      downheap(0);
  until n &lt;= 0  
  </code></pre>
  
  <p>Can some one please explain to me what is done in lines  </p>
  
  <pre><code>    n=m
      for k:= m div 2 down to 0
          downheap(k);  
  </code></pre>
  
  <p>I think that is the heap building process but what is mean by <code>for k:= m div 2 down to 0</code>  </p>
  
  <p>Also is n the number of items.So in an array representation last element is stored at a[n-1]?
  But why do it for n> <strong>=</strong> 0. Can't we finish at  n>0.Because the first element gets automatically sorted?</p>