another version of heapsort