
[理工] 資結 Child Node

想問一段敘述
給了一張圖片,並詳細敘述了以下,
我的問題在於,明明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
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 223.140.130.240
※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1530795333.A.E1D.html
※ 編輯: s9e0ay917 (223.140.130.240), 07/05/2018 21:36:26
→
07/05 23:45,
7年前
, 1F
07/05 23:45, 1F
B只有一個child node但敘述上說B有2個child node 我的問題在這裡
※ 編輯: s9e0ay917 (223.140.130.240), 07/06/2018 00:02:04
→
07/06 00:02,
7年前
, 2F
07/06 00:02, 2F
這個明白:) 所以圖片的B節點有兩個child node,這是正確的嗎?
※ 編輯: s9e0ay917 (223.140.130.240), 07/06/2018 00:03:10
→
07/06 00:08,
7年前
, 3F
07/06 00:08, 3F
這樣的話,B的左子樹等於一個節點嗎?可是好像不太對><
想請問child node一定要是存在的點嗎?
如果不存在,可以說一個Leaf node有兩個child node嗎?
很抱歉想釐清一些細節觀念><很感謝你的回覆
※ 編輯: s9e0ay917 (223.140.130.240), 07/06/2018 00:17:54
※ 編輯: s9e0ay917 (223.140.130.240), 07/06/2018 00:18:19
推
07/06 08:53,
7年前
, 4F
07/06 08:53, 4F
→
07/06 08:53,
7年前
, 5F
07/06 08:53, 5F
推
07/06 08:57,
7年前
, 6F
07/06 08:57, 6F
→
07/06 08:57,
7年前
, 7F
07/06 08:57, 7F
謝謝你的解釋,我好像明白你的意思,但這網站有題練習題(我放在這裡了),說明每個bi
nary tree上的node,都一定有兩個children><
下面的解釋說即便沒有節點,每個node都會有兩個child? 感覺這個網站解釋的有點牽強
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.(看不太懂這句給的結論)
※ 編輯: s9e0ay917 (223.136.141.231), 07/06/2018 10:54:45
→
07/06 11:58,
7年前
, 8F
07/06 11:58, 8F
→
07/06 12:06,
7年前
, 9F
07/06 12:06, 9F
→
07/06 12:07,
7年前
, 10F
07/06 12:07, 10F
→
07/06 12:08,
7年前
, 11F
07/06 12:08, 11F
推
07/06 14:37,
7年前
, 12F
07/06 14:37, 12F
→
07/06 19:23,
7年前
, 13F
07/06 19:23, 13F
→
07/06 19:28,
7年前
, 14F
07/06 19:28, 14F
推
07/06 22:11,
7年前
, 15F
07/06 22:11, 15F
→
07/06 22:13,
7年前
, 16F
07/06 22:13, 16F
→
07/06 22:13,
7年前
, 17F
07/06 22:13, 17F
→
07/06 22:13,
7年前
, 18F
07/06 22:13, 18F
很謝謝你的解釋!!
→
07/07 00:05,
7年前
, 19F
07/07 00:05, 19F
→
07/07 00:06,
7年前
, 20F
07/07 00:06, 20F
謝謝你,我了解了:)
※ 編輯: s9e0ay917 (42.77.129.85), 07/09/2018 13:05:17