It is a self-balancing Binary Search Tree with specific coloring rules to maintain balance.
Binary Search Tree
Usually for most cases Red-Black Trees are preferred over AVL Trees.
Red-Black Trees
AVL Trees
The color field can be just a 1bit property like 0 or 1.
color
0
1
The root node is always Black.
By default every new node in the Tree will be Red. Then it wil be checked to see if it can keep being Red or if it will be changed to Black.
A Red node can only have Black parents and children.
Have a better insertion time than AVL Trees. (Since it is less aggressive in balancing the Tree)
Last updated 1 month ago