Algorithms implemented in C++ for study purpose