apply minHeap