chapter_tree/avl_tree/ #85
Replies: 57 comments 75 replies
-
这部分确实是有点难度 |
Beta Was this translation helpful? Give feedback.
-
K神有时间可以更新一章红黑树的区别吗?想看看它们的区别和各自的应用场景,感谢! |
Beta Was this translation helpful? Give feedback.
-
您好,请问python的会更新吗 |
Beta Was this translation helpful? Give feedback.
-
K神会更新图数据结构嘛 ? |
Beta Was this translation helpful? Give feedback.
-
大佬,请问这一节中哪些函数归在private,哪些函数归在public中,这方面有什么考量吗?比如为什么要将 height 函数和 updateHeight 函数 分别放在 public 和 private 中呢? |
Beta Was this translation helpful? Give feedback.
-
有个疑问,我看右旋操作是处理失衡节点node、child、grandchild之间的关系,那node的父级和node原来的连接不需要维护吗?右旋操作后岂不是断掉了? |
Beta Was this translation helpful? Give feedback.
-
k神,这部分还会介绍红黑树吗? |
Beta Was this translation helpful? Give feedback.
-
大佬,想问一下,updateHeight()方法里为啥要 + 1 操作? |
Beta Was this translation helpful? Give feedback.
-
/* 右旋操作 */ |
Beta Was this translation helpful? Give feedback.
-
讲的不错,经过你的讲解感觉AVL树只有红黑树10%的难度 |
Beta Was this translation helpful? Give feedback.
-
复刻了一下 感觉可以的 |
Beta Was this translation helpful? Give feedback.
-
大佬,先左旋再右旋那张图,child.left=node, node.left=null也可以达到平衡吧,只是破坏了二叉搜索树的规则,这种做法属于左旋吗?左旋的时候child既可以取node左子节点也可以取右子节点吧,右旋同理 |
Beta Was this translation helpful? Give feedback.
-
if t.balanceFactor(node.Left) >= 0 { 为什么判断条件是 >= 0,是不是 > 0 也可以,因为左右高度差不可能为 0 |
Beta Was this translation helpful? Give feedback.
-
为什么不用 updateHeight(grandChild) 呀? |
Beta Was this translation helpful? Give feedback.
-
这里讲的真好,清楚易懂 |
Beta Was this translation helpful? Give feedback.
-
作者大大,我有一个问题,在c语言中,旋转总函数里面,不论你是上述四种失衡情况的哪一种,都会使node,child,grandchild变成一个横向链表,那在定义左旋和右旋函数中grandchild节点应该不需要声明吧? |
Beta Was this translation helpful? Give feedback.
-
作者你好,在向右旋转的python版本代码中有个疑问: |
Beta Was this translation helpful? Give feedback.
-
期待可以早日加上红黑树,B+树,B-树的内容 |
Beta Was this translation helpful? Give feedback.
-
关于插入节点的函数的问题:这个函数更新节点高度的部分似乎永远不会执行。 |
Beta Was this translation helpful? Give feedback.
-
7.5.3 AVL树常用操作里面 1.插入节点的代码部分,
没有在旋转操作之后调用updateHeight方法是不是因为balanceFactor方法调用了height方法,而height方法是递归的,所以节点已经实际上更新了高度的原因? |
Beta Was this translation helpful? Give feedback.
-
C++ /* 递归插入节点(辅助方法) */ |
Beta Was this translation helpful? Give feedback.
-
个人的一些记忆方法 设本节点为T(ree) 本节点的左孩子 L 右孩子R R的右孩子r L的左孩子 |
Beta Was this translation helpful? Give feedback.
-
建议:可以扩展一个新的章节: 红黑树 |
Beta Was this translation helpful? Give feedback.
-
Btree Rtree 红黑树什么时候考虑加上呀 |
Beta Was this translation helpful? Give feedback.
-
在作者还没有开辟红黑树之前,这里先给出C++版本的红黑树哈 enum RBTColor { RED, BLACK }; template
}; template public:
private:
#define rb_parent(r) ((r)->parent) /*
/*
/*
template /*
template /*
template /*
template /*
template /*
template
} /*
template
} /*
/*
/*
/
} /*
/
} /*
/
} /*
/
} /*
/
} /*
template /*
/
} template int main()
} */ |
Beta Was this translation helpful? Give feedback.
-
有关红黑树和一些算法导论中的数据结构的内容可以查看我的项目 https://github.com/whoamiR/the-Algorithms-on-Introduction-to-Algorithms/tree/main/Advanced_Data_Structure |
Beta Was this translation helpful? Give feedback.
-
感觉挺清楚的,期待加入红黑树 |
Beta Was this translation helpful? Give feedback.
-
我个人对平衡二叉树旋转的理解: |
Beta Was this translation helpful? Give feedback.
-
chapter_tree/avl_tree/
Your first book to learn Data Structure And Algorithm.
https://www.hello-algo.com/chapter_tree/avl_tree/
Beta Was this translation helpful? Give feedback.
All reactions