An implementation of HeapSort (for testing purposes)