algorithms in C++