Is the root node an internal node?

后端 未结 4 1846
滥情空心
滥情空心 2021-02-20 05:57

So I\'ve looked around the web and a couple of questions here in stackoverflow here are the definition:

  • Generally, an internal node is any node that is not a leaf
4条回答
  •  悲哀的现实
    2021-02-20 06:19

    Yes root node is an internal node.
    [More explanation]

    A root node is never called as a leaf node even if it is the only node present in the tree. For ex. if a tree has only one node then we say that it is a tree with only root node, we never say that the tree has a single leaf node.
    Since internal node means a non-leaf node and because root node is never considered as leaf node I would say that in case of single node tree root node is an internal node.

提交回复
热议问题