Introduction to Algorithms fourth edition by Charles E. Leiserson