modified heapsort.c