Red-Black Tree

Properties of a Red-Black Tree

Inserting into a Red-Black Tree

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

Example of Red-Black Tree

Red-Black Tree Insertion Diagram

For more information, refer to Introduction to Red-Black Tree.