data-structures - 什么是树中的节点?

标签 data-structures tree nodes treenode

根据 wiki , 树中的一切都是一个节点。

树中使用的术语

Root – The top node in a tree.
Parent – The converse notion of child.
Siblings – Nodes with the same parent.
Descendant – a node reachable by repeated proceeding from parent to child.
Ancestor – a node reachable by repeated proceeding from child to parent.
Leaf – a node with no children.
Internal node – a node with at least one child.
External node – a node with no children.
Degree – number of sub trees of a node.
Edge – connection between one node to another.
Path – a sequence of nodes and edges connecting a node with a descendant.
Level – The level of a node is defined by 1 + the number of connections between the node and the root.
Height of tree –The height of a tree is the number of edges on the longest downward path between the root and a leaf.
Height of node –The height of a node is the number of edges on the longest downward path between that node and a leaf.
Depth –The depth of a node is the number of edges from the node to the tree's root node.
Forest – A forest is a set of n ≥ 0 disjoint trees.

但后来我从SAP http://www.sapdesignguild.org/community/design/print_hierarchies2.asp中找到了下面的图片 enter image description here

所以我的问题 - 将树中的根、叶、 parent 、 child 、 sibling 称为节点是否正确?

最佳答案

是的。根是“根节点”。父节点是“父节点”。叶是“叶节点”。树由节点组成。根、父、子、兄弟、叶等术语只是描述节点之间的关系。

例如,根节点没有父节点。叶节点没有 child 。兄弟节点共享同一个父节点。

关于data-structures - 什么是树中的节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28762037/

相关文章:

java - POP方法链表

C++ 二叉搜索树 - 复杂类型

C# 使用 base 中的链表数据结构

在 C 中创建堆栈,节点结构

java - 用于确定是否可以在多色节点图的两个节点之间找到相同颜色节点的路径的最有效算法

java - java中的RedBlackTree插入实现

java - 如何实现泛型的抽象类?

java - 我如何访问 vaadin 树中的对象?

algorithm - 从列表重建一棵树,深度信息封装在列表的条目中

c - 我正在尝试按分数对节点进行排序。我不知道我有什么错误