change heap sort with template