C++ code to implements the heap sort algorithm