add from ex-2.59 to ex-2.62, tree functions in the book