code and algorithms from the Cormen Algorithm book