chapter_tree/binary_tree/ #153
Replies: 37 comments 52 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.
-
二叉树的「高度 height」:从根节点到最远叶节点所经过的边的数量。 |
Beta Was this translation helpful? Give feedback.
-
很高兴可以发现这个宝藏网站。
具体是什么样的结构?尽量靠左填充是如何操作的?怎样才算不尽量?如何的不尽量靠左填充会让这个结构不是一个完全二叉树? 最后,很高兴可以有这样一个评论区,可以在啃书的时候提出疑问。 |
Beta Was this translation helpful? Give feedback.
-
k神这个可以添加导出为PDF的功能吗,我想把某个章节喂到ChatGPT进行对话式学习。 |
Beta Was this translation helpful? Give feedback.
-
我把二叉树当成倒着的树来看是不是就可以了TAT |
Beta Was this translation helpful? Give feedback.
-
请问在二叉树常用术语中最远叶节点是指什么含义呢?有严格的定义吗? |
Beta Was this translation helpful? Give feedback.
-
请问插入一个节点的时候,不用比较相邻节点的大小吗? |
Beta Was this translation helpful? Give feedback.
-
K神,判断节点高度中,"从距离该节点最远的叶节点到该节点所经过的边的数量",其中的叶节点是默认对应子树下的情况吗? |
Beta Was this translation helpful? Give feedback.
-
把节点度数改成出度和入度比较好,出度和入度之和为该节点的度数,二叉树就是一个根节点入度为0,叶节点出度为0的无回路连通图。这样还可以利用握手定理,进一步推出二叉树的边数=节点数-1 |
Beta Was this translation helpful? Give feedback.
-
你好,我想问一下在二叉树节点结构体中,本页展示的代码只有left和right两个节点但在文件中那个的代码却有parent共3个节点,有和书中一样的示例代码吗 |
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.
-
你的邮件我已经收到!
|
Beta Was this translation helpful? Give feedback.
-
有人能帮忙解释一下,图 7-7平衡二叉树,第二层左边的节点的d=1是怎么算的, 它只有一个左子节点,没有右子节点。 那它的左子树高度为0? 没有右子树? |
Beta Was this translation helpful? Give feedback.
-
chapter_tree/binary_tree/
一本动画图解、能运行、可提问的数据结构与算法入门书
https://www.hello-algo.com/chapter_tree/binary_tree/
Beta Was this translation helpful? Give feedback.
All reactions