Red Black Tree Rules - type of BST
VAL vs red-black trees
red-black trees are less-perfectly balanced. However, they generally need fewer rotations during insertion/deletion, which makes red-black tree superior for growing or shrinking a tree, but less efficient for searching.
Both O(log n) time complexity
AVL might have greater height and use more memory than Red Black Trees
VAL self-balancing BST
Uses balance factor (absolut delta between height of left and right subtree).
Balanced if this delta is smaller equal to one for every node.
How to rebalance AVL
Start from the lowest unbalanced tree.
Label the three nodes, starting from the unbalanced one.
Rearrange.
Check balance factor of ancestor
Condition that must be fulfilled such that tree operations are log n
Tree must be balanced