Various algorithms implemented in C++