trees code problems