some algorithm exercises written in c++