When to choose RB tree, B-Tree or AVL tree?

后端 未结 4 448
小鲜肉
小鲜肉 2021-01-29 17:34

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

4条回答
  •  盖世英雄少女心
    2021-01-29 18:09

    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.

提交回复
热议问题