C++ sorting algorithms