Implementation of the Max-Sum Algorithm in C++