您的位置:首页 > 理论基础 > 数据结构算法

数据结构->树:树的深度与高度

2014-06-09 13:21 204 查看
树的高度与深度是不一样的概念:

The depth of a node is the number of edges from the node
to the tree's root node.

A root node will have a depth of 0.

The height of a node is the number of edges on the longest
path from the node to a leaf.

A leaf node will have a height of 0.



但有时候不同书上对只有一个根节点的数的深度有不同的说法,有的认为是0(上例即是),有的认为是1。题目如果涉及到root的深度,应该会给出。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: