Introduction to algorithms - Cormen, Thomas H.; Leiserson, Charles Eric.; Rivest, Ronald L.; Stein, Clifford. (The MIT Press, 2001)