From basic to more complex sorting algorithms in C++