modify the function heapSort() and buildMaxHeap()