Implementation of a priority queue and in turn use of it to implement the heapsort algorithm.