Common-used C++ algorithm class.