C++ Implementation for algorithms described on http://decomplexify.blogspot.com/