Is this a question for homework? If so, please tag this question with the homework
tag so that it is clear. My answer assumes it is for homework.
Trees are a recursive data structure, so the algorithms that operate on them will often be recursive. Recursive algorithms need a base case and an inductive case. For trees, the base case will be what you do when you are visiting a leaf node (i.e. a node without children). The inductive case will be what you do when you are visiting an internal node (i.e. a node with at least one child).
For calculating depth (or "height" of the tree):
- Base case: What is the depth of a node without children?
- Inductive case: Given that you have the depths of all of your children (which could be different), what is the depth of the current node you're visiting?
For calculating descendant count:
- Base case: How many descendants does a node without children have?
- Inductive case: Given that you know the descendant count of all of your children, what is the descendant count of the current node you're visiting?
I encourage you to ask clarifying questions.