为什么红黑树比 2-3 棵树更好?
除了红黑更容易实现之外。
在两棵树中,所有操作(插入、删除、查找)的时间复杂度似乎都是 O(log n)。我所缺少的这些操作之间有什么区别吗?
如果你用谷歌搜索“红黑”“2-3树”,你找不到两者之间的任何比较..
我开始明白红黑通常被认为是最好的。 (我听说红黑比 AVL 树(同一类别)更快的原因之一是“应用到持久数据结构”的效率,因为重新平衡效率;但这并不'不回答我的问题..)
Apart from red-blacks being easier to implement.
All operations (insertion, deletion, lookup) seem to have a time complexity of O(log n), in both trees. Is there a certain difference between these operations that I'm missing?
If you google search "red-black" "2-3 tree", you don't find any comparison between the two..
I've come to understand that red-blacks are generally considered to be the best. (I've heard that one of the reasons [EDIT] why red-blacks are faster than AVL trees (same category)[/EDIT] is efficiency in "application to persistent data structures", because of rebalancing efficiency; but that doesn't answer my question..)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不熟悉 2-3 树,但我非常确定 B 树是持久数据库/文件系统的首选。红色/黑色更常用于内存
I'm not familiar with 2-3 trees, but I am pretty sure that B-Trees are by far the preferred for persistent database/filesystems. Red/Black more often used in memory
直接来自 B 树的维基百科条目(其中 2 3 树是一种类型的):
Straight from the Wikipedia entry for B-Trees (of which the 2 3 tree is a type of):