algorithms in c++