Implementation of sorting algorithms in c++