heapsort in the same list