What is the difference between tree depth and height?

后端 未结 7 1591
[愿得一人]
[愿得一人] 2020-11-28 00:14

This is a simple question from algorithms theory.
The difference between them is that in one case you count number of nodes and in other number of edges on the shortest

7条回答
  •  庸人自扰
    2020-11-28 00:43

    height and depth of a tree is equal...

    but height and depth of a node is not equal because...

    the height is calculated by traversing from the given node to the deepest possible leaf.

    depth is calculated from traversal from root to the given node.....

提交回复
热议问题