Finish the priority queue with heap