what do you mean by depth of a tree
Answers
Answer:
The depth of a node M in the tree is the length of the path from the root of the tree to M. The height of a tree is one more than the depth of the deepest node in the tree. All nodes of depth d are at level d in the tree. The root is the only node at level 0, and its depth is 0.
Explanation:
Hope it helps you
Answer:
For each node in a tree, we can define two features: height and depth. A node’s height is the number of edges to its most distant leaf node. On the other hand, a node’s depth is the number of edges back up to the root. So, the root always has a depth of 0 while leaf nodes always have a height of 0. And if we look at the tree as a whole, its depth and height are both the root height.
Explanation:
I hope this will helpful to you