It is wasteful of the first element of the array, so start at 0. Also std:swap was re-implemented just use swap available in C++ library instead.
* variable x is unused * Use std::endl and a blank line between functions Co-authored-by: Christian Clauss <cclauss@me.com>
* Use getchar over getch getch in Windows specific. Now the code will compile and work on other platforms like Linux and macOS. * Update and rename Heap Sort .cpp to heap_sort .cpp * cpplint fixes * Rename heap_sort .cpp to heap_sort.cpp