This page introduces a data structure we discussed during class----the red black tree
A Red Black Tree is a self-balanceing binary search tree.
It uses red and black node colors to keep the tree balanced, which helps search, insert and delete operations more efficient than a simple binary search tree.
There are mainly 3 steps to insert data in to R-B trees
For repairing a red root, if the root of the tree is red, we can switch it to black without violating any other property.
For repairing red node with red child, we need to pick a repair operation:
There are mainly 2 steps to delete data in a R-B tree
For repairing, if the deleted node is black and replacement is red, turn replacement black
For black node without red replacement, we also need to pick the operation:
For time complexity and other detailed information, here's a place to visit:
click here!Thank you for visiting this site!