Introduction to algorithms - CORMEN, Thomas H.; LEISERSON, Charles E.; RIVEST, Ronald L.; STEIN, Clifford (The MIT Press, 2009)