Cormen, Thomas H.Introduction to algorithms.