STL and algorithms in cpp