implemented in-place heap sort