Hammer interview question

Not too difficult, but binary tree algorithms