Sample algorithms in C++ and Ruby.