heapsort modified to accept all objects implementing sort interface