树中的节点是什么?

时间:2015-02-27 09:50:48

标签: 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

所以我的问题 - 在树中调用root,leaf,parents,children,siblings作为节点是正确的吗?

1 个答案:

答案 0 :(得分:3)

是。根是"根节点。"父母是父母节点。"叶子是叶子节点。"树由节点组成。术语root,parent,child,sibling,leaf等只是描述节点之间的关系。

例如,根节点没有父节点。叶节点没有孩子。同级节点共享同一个父节点。