recommendation algorithm in C++