Red-Black Trees

A red-black trees is a self-balancing binary search tree in which every node is colored with either red or black. The tree adjusts itself automatically after each insertion or deletion operation by coloring each node in the tree either red or black.

Properties of Red-Black Trees

How to insert into a Red-Black Tree:

  1. Insert new key using BST insertion algorithm
  2. Color new node red
  3. Check red black tree properties and restore if necessary

Tips for repairing an insertion

How to delete from a Red-Black Tree:

  1. Delete key using BST deletion algorithm
  2. Check red black tree properties and restore if necessary

Tips for repairing a deletion

Learn More

Red Black Trees on Wikipedia