complete the basic printTree method