buildMaxHeap function