algorithms in C++ from Cormen's Introduction to Algorithms