Red black tree over avl tree

前端 未结 5 1458
醉梦人生
醉梦人生 2021-01-29 17:39

AVL and Red black trees are both self-balancing except Red and black color in the nodes. What\'s the main reason for choosing Red black trees instead of AVL trees? What are the

5条回答
  •  轮回少年
    2021-01-29 18:32

    Our understanding of the differences in performance has improved over the years and now the main reason to use red-black trees over AVL would be not having access to a good AVL implementation since they are slightly less common perhaps because they are not covered in CLRS.

    Both trees are now considered forms of rank-balanced trees but red-black trees are consistently slower by about 20% in real world tests. Or even 30-40% slower when sequential data is inserted.

    So people who have studied red-black trees but not AVL trees tend to choose red-black trees. The primary uses for red-black trees are detailed on the Wikipedia entry for them.

提交回复
热议问题