Introduction to Algorithms (3rd Edition)