Code I wrote when reading http://en.wikipedia.org/wiki/Introduction_to_Algorithms