Implementing algorithms through C++