Grad-ProbAsk 板


LINE

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 --



※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 223.140.130.240
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Grad-ProbAsk/M.1530795333.A.E1D.html ※ 编辑: s9e0ay917 (223.140.130.240), 07/05/2018 21:36:26
1F:→ outofyou: 空的左子树,有问题吗?07/05 23:45
B只有一个child node但叙述上说B有2个child node 我的问题在这里 ※ 编辑: s9e0ay917 (223.140.130.240), 07/06/2018 00:02:04
2F:→ h90243768: Binary tree 可以为空07/06 00:02
这个明白:) 所以图片的B节点有两个child node,这是正确的吗? ※ 编辑: s9e0ay917 (223.140.130.240), 07/06/2018 00:03:10
3F:→ h90243768: 是 文後面有说啊 B的左子树为空树07/06 00:08
这样的话,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
4F:推 EXPCDR: 好怪 通常这样不会说他有两个子点吧,不然每个二元树的no07/06 08:53
5F:→ EXPCDR: de degree就永远为2了,那就跟Strict 二元树的定义一样了07/06 08:53
6F:推 EXPCDR: 我觉得他说B的左子点是empty tree不是在表达他有左子点, 07/06 08:57
7F:→ EXPCDR: 就只是在表达他左子点上的位置是放空树07/06 08:57
谢谢你的解释,我好像明白你的意思,但这网站有题练习题(我放在这里了),说明每个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
8F:→ outofyou: 他都刻意只有说children,没有说child node, 07/06 11:58
9F:→ outofyou: 二元树里degree有0,1,2,3可能,定义好edge要有连node即可 07/06 12:06
10F:→ outofyou: 会有其他树在讨论时把leaf node的children做考虑, 07/06 12:07
11F:→ outofyou: 所以要看个别讨论的对象及个别定义的方式。 07/06 12:08
12F:推 EXPCDR: 那个..请问为什麽二元树degree可能为3 07/06 14:37
13F:→ outofyou: 抱歉,我用的定义是有二元树结构的无向图中的节点degree07/06 19:23
14F:→ outofyou: 参https://en.wikipedia.org/wiki/Tree_(graph_theory) 07/06 19:28
15F:推 EXPCDR: 二元树可以为空,空数node数为0,所以A错07/06 22:11
16F:→ EXPCDR: 他是说所有二元树的node都有两个children,注意他不是说c07/06 22:13
17F:→ EXPCDR: hildren node。但不是所有二元树都有node,例如空数就没07/06 22:13
18F:→ EXPCDR: 有node07/06 22:13
很谢谢你的解释!!
19F:→ eggy1018: Binary tree 每个node 一定有两个child07/07 00:05
20F:→ eggy1018: Child 有value 就是node, 没有就是empty07/07 00:06
谢谢你,我了解了:) ※ 编辑: s9e0ay917 (42.77.129.85), 07/09/2018 13:05:17







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Soft_Job站内搜寻

TOP