working heap sort