gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 03:13:48 24 4
gpt4 key购买 nike

根据 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com