Introduction to Algorithms, Third Edition by Thomas H. Cormen & Charles E. Leiserson