Algorithms implemented in C++