Takeaways
- A red black tree is a self-balancing BST
- In a RBT, nodes are colored either "Red" or "Black". We must follow the five rules for maintaining a RBT (see slides)
- If a tree is a red/black tree, we will get O(logn) insertions, removal, and searching time (much better than O(n))
- If a node is inserted or removed from a RBT, rotations can be done to rebalance the tree
- Managing a RBT takes O(1) time
Code
February 27th code is a program that validates a red black tree (makes sure it does not violate the five rules).