C++ implementation of different sorting algorithms