begin heap sort