From Aho, Hopcroft, Ullman, "Data Structures and Algorithms". pg. 234, pg. 235, pg. 236, pg. 237, pg. 238, pg. 239,