何时选择RB树,B树或AVL树? [英] When to choose RB tree, B-Tree or AVL tree?

查看:186
本文介绍了何时选择RB树,B树或AVL树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为程序员,我应该考虑使用RB树,B-树或AVL树?
在决定选择之前,需要考虑的要点是什么?



有人可以为每个树结构解释为什么选择其他树的关键点?

解决方案

使用一小段盐:



当您管理数以千计的项目时,B-tree并且您正在从磁盘或某些缓慢的存储介质中分页。



当您在树上进行相当频繁的插入,删除和检索时,RB树。 p>

当您的插入和删除不相对于您的检索时,AVL树。


As a programmer when should I consider using a RB tree, B- tree or an AVL tree? What are the key points that needs to be considered before deciding on the choice?

Can someone please explain with a scenario for each tree structure why it is chosen over others with reference to the key points?

解决方案

Take this with a pinch of salt:

B-tree when you're managing more than thousands of items and you're paging them from a disk or some slow storage medium.

RB tree when you're doing fairly frequent inserts, deletes and retrievals on the tree.

AVL tree when your inserts and deletes are infrequent relative to your retrievals.

这篇关于何时选择RB树,B树或AVL树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆