Introduction to Algorithms, fourth edition