Implemented heap sort using a functor :-)