Notes

Search

Search IconIcon to open search

Red Black Trees Definition

Last updated Dec 30, 2022

Red Black Trees are trees that are structurally indentical to B-Trees, but have glue links. This idea is commonly used in practice (ex: java.util.TreeSet).

A BST with left glue links are called a left-leaning red-black BST.

Red Black Tree Properties

From this, we get two very important properties:

Therefore, LLRBs are perfectly balanced.

The way we’d implement this is to insert as usual into a BST, and then do some number of rotations to maintain the 1-1 mapping.