priority queue min heap implementation with heapsort