chapter_tree/binary_tree/ #153
Replies: 46 comments 68 replies
-
/* 插入与删除结点 */ |
Beta Was this translation helpful? Give feedback.
-
”二叉树中的插入与删除一般都是由一套操作配合完成的“,这里的”一套操作“指什么呢?可以理解为资源的子节点的资源释放吗? |
Beta Was this translation helpful? Give feedback.
-
我对高度的定义有点疑问,如果高度的定义是走过边的数量,那么只有根节点的二叉树,高度是否就是0,完美二叉树总结点数量=2^0-1=0 |
Beta Was this translation helpful? Give feedback.
-
那么有一个结点的二叉树,高度和深度都是0,对吗 |
Beta Was this translation helpful? Give feedback.
-
7.1.3 tips: |
Beta Was this translation helpful? Give feedback.
-
请问一下画图是用的什么工具啊, 很好看! |
Beta Was this translation helpful? Give feedback.
-
类比楼的高度,和水的深度,从下往上看和从上往下看 |
Beta Was this translation helpful? Give feedback.
-
感觉二叉树的内容有点少,案例缺失,能补充点实际场景吗? |
Beta Was this translation helpful? Give feedback.
-
在完美二叉树的定义中,这里写的是(除了最底层外,其余所有层的节点都被完全填满) |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
完美二叉树中,说了“若树高度为h,则节点总数为2^(h+1)”,这里不应该用“高度”,而应该用“深度”吧?包括后面的陈述都是用的“高度”这个词。 |
Beta Was this translation helpful? Give feedback.
-
作者你好,根据文章里“7.1.1二叉树常见术语”中的定义,以及使用“边”来衡量“高度”与“深度”,有一个疑惑:叶子节点的“高度”是 0 吗?类似的,只有一个根节点的二叉树,该树的“高度”是 0 吗? 我问的这个问题,直接关系到我对于“图7-7平衡二叉树”里的“变量 d ”的计算的理解,因为这个地方我没看懂,我自己根据上文的定义来计算每个节点的 d 的值,发现跟文中对不上~~ |
Beta Was this translation helpful? Give feedback.
-
节点的「高度 height」:从最远叶节点到该节点所经过的边的数量。 |
Beta Was this translation helpful? Give feedback.
-
我大学教材和百度的大部分答案说, 树的高度是从根节点到最远节点的节点个数而不是边的个数,因此树的高度 = 树的深度 = 树中节点的最大高度 + 1 ,!= 节点的最大高度。本文定义是否有误?最后的表格中,是否“高度为 h 的树的节点总数”应为“ 2 ^ h - 1” ? 不知道是不是有多种定义, 供作者参考喵 |
Beta Was this translation helpful? Give feedback.
-
才知道原来汉语里面parent node是父节点...😅 |
Beta Was this translation helpful? Give feedback.
-
大佬您好!初学算法,有个疑问。图7-3中,插入树节点时,代码顺序是n1.left = p 然后p.left = n2,可是这样不会导致n2找不到吗?就和链表的插入操作一样,不应该先让p.next连接上n2,再让n1.next链接p吗?不知道我的理解是否有误 |
Beta Was this translation helpful? Give feedback.
-
我不明白,C的代码里面有节点高度 |
Beta Was this translation helpful? Give feedback.
-
新增内容:
此处的1应注明该定义不统一, 一说为0. https://stackoverflow.com/questions/59151282/what-is-level-of-root-node-in-a-tree |
Beta Was this translation helpful? Give feedback.
-
h树高的perfect binary tree的节点计算是等比公式求和{1,2,4,8...} |
Beta Was this translation helpful? Give feedback.
-
有人能帮忙解释一下,图 7-7平衡二叉树,第二层左边的节点的d=1是怎么算的, 它只有一个左子节点,没有右子节点。 那它的左子树高度为0? 没有右子树? |
Beta Was this translation helpful? Give feedback.
-
打开 |
Beta Was this translation helpful? Give feedback.
-
'''完全二叉树(complete binary tree)只有最底层的节点未被填满,且最底层节点尽量靠左填充。''' |
Beta Was this translation helpful? Give feedback.
-
day06 |
Beta Was this translation helpful? Give feedback.
-
请问:是否节点所在的层(level) = 节点的深度(depth)+ 1,该公式是否成立? |
Beta Was this translation helpful? Give feedback.
-
请问“在完美二叉树中,叶节点的度为 0,其余所有节点的度都为 2;” 不是所有的二叉树的叶节点的度都为0吗,如果节点的度不为0,肯定不是二叉树啊 |
Beta Was this translation helpful? Give feedback.
-
最后一个表格“ 二叉树的最佳结构与最差结构”,第二行“高度为 h 的树的叶节点数量”,链表为何是 1 ,不应该是 h 吗? |
Beta Was this translation helpful? Give feedback.
-
二叉树的高度(height):从根节点到最远叶节点所经过的边的数量。 |
Beta Was this translation helpful? Give feedback.
-
谢谢,您的邮件我已收到。
|
Beta Was this translation helpful? Give feedback.
-
删除节点时,应彻底断开被删除节点与前后节点的所有关联,避免残留引用。 // 删除节点 P |
Beta Was this translation helpful? Give feedback.
-
谢谢,您的邮件我已收到。
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
chapter_tree/binary_tree/
一本动画图解、能运行、可提问的数据结构与算法入门书
https://www.hello-algo.com/chapter_tree/binary_tree/
Beta Was this translation helpful? Give feedback.
All reactions