Code while learning Introduction to Algorithm