Implemented heap sort.