Introduction to algorithms - Cormen, TH; Leiserson, CE; Rivest, RL; Stein, C (MIT Press, 2001)