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

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

问题描述

作为程序员,我什么时候应该考虑使用 RB 树、B 树或 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?

推荐答案

加点盐:

当您管理超过数千个项目并从磁盘或某些慢速存储介质对它们进行分页时,请使用 B 树.

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 树,当您在树上进行相当频繁的插入、删除和检索时.

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

当您的插入和删除相对于您的检索不频繁时的 AVL 树.

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

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

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