code written during reading Introduction to Algorithms