C++ exercise implementation of ML algorithms