Form the Heap Code
void FormHeap ( int Table [ ], int Range) {
int k, LeafPos, Done, temp;
for ( k = 1; k <= Range; k++ ) {
while ( ( LeafPos > 1 ) && ( ! Done ) )
if ( Table [ LeafPos ] > Table [ LeafPos / 2 ] ) {
temp = Table [ LeafPos ];
Table [ LeafPos ] = Table [ LeafPos / 2 ];
Table [ LeafPos / 2 ] = temp; LeafPos = LeafPos / 2; }