C++ implementations of basic algorithms