https://i.imgur.com/DWfMUej.jpg
想問一段敘述
給了一張圖片,並詳細敘述了以下,
我的問題在於,明明B只有一個child,為什麼他要說B有兩個children. 難道"Empty"也算
一個node嗎?
Figure 7.2.1:
*****
Node B has two children: Its left child is the empty tree and its right child
is D. (我的問題在這裡)
*****
我的疑點是從這個網站的練習題其中一題才有的,另外附上此網站的練習題
Which statement is false? (答案是A,我的疑點在D)
(A) Every binary tree has at least one node
(B) Every non-empty binary tree has exactly one root node
(C) Every non-root node in a binary tree has exactly one parent
(D) Every node in a binary tree has exactly two children
(E) None of the above
他的解釋如下:
Look carefully at the definition for a binary tree.
It states that every binary tree is either empty, or it has a root node and tw
o binary trees as children.
So, every binary tree node has two children, but not every binary tree has a n
ode.(看不太懂這句給的結論)
來源:https://opendsa-server.cs.vt.edu/ODSA/Books/CS3/html/BinaryTree.html#def
initions-and-properties