这是一个来自算法理论的简单问题.它们之间的区别在于,在一种情况下,您计算根节点和具体节点之间最短路径上的节点数和其他边数.哪个是哪个?
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 path between root and concrete node. Which is which?
推荐答案我了解到深度和高度是节点的属性:
I learned that depth and height are properties of a node:
节点的深度是从节点到树根节点的边数.根节点的深度为0.
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.
节点的高度是从节点到叶节点的最长路径上的边数.叶节点将具有高度为 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.
树的属性:
树的高度将是其根节点的高度,或等效地,其最深节点的深度.
The height of a tree would be the height of its root node,or equivalently, the depth of its deepest node.
树的直径(或宽度)是任意两个叶节点之间最长路径上节点的数量.下面的树的直径为 6 个节点.
The diameter (or width) of a tree is the number of nodes on the longest path between any two leaf nodes. The tree below has a diameter of 6 nodes.
更多推荐
树的深度和高度有什么区别?
发布评论