Basic sorting algorithms in Cpp