add depth of a tree