C/C++ algorithms