为什么红黑树比 2-3 棵树更好?

发布于 2024-10-03 08:59:16 字数 222 浏览 0 评论 0原文

除了红黑更容易实现之外。

在两棵树中,所有操作(插入、删除、查找)的时间复杂度似乎都是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅忆流年 2024-10-10 08:59:16

我不熟悉 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

云归处 2024-10-10 08:59:16

直接来自 B 树的维基百科条目(其中 2 3 树是一种类型的):

与自平衡二分查找不同
树,B 树经过优化
读取和写入大数据的系统
数据块。它常用于
数据库和文件系统。

Straight from the Wikipedia entry for B-Trees (of which the 2 3 tree is a type of):

Unlike self-balancing binary search
trees, the B-tree is optimized for
systems that read and write large
blocks of data. It is commonly used in
databases and filesystems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文