heapsort implemented and tested