Code written while studying Introduction to Algorithms