Python: red-black tree

Red-black tree and AVL comparison:

AVL is strictly balanced tree, so when adding or removing a node, depending on the circumstances, the number of rotations to be more than a red-black tree;

Red and black with a strict non-equilibrium in exchange for reducing the number of rotations of node additions and deletions time;

So it simply, if your application number, the search is far greater than the insertion and deletion, then select AVL, if you search, insert delete almost the same number should be selected RB.

Guess you like

Origin blog.csdn.net/weixin_44523387/article/details/91973851