What Is a Red-Black Tree?

A red-black tree is a binary search tree in which each node is assigned either a red or black color. Its coloring rules help prevent the tree from becoming excessively unbalanced.

Example diagram of a red black tree

Important Properties

Why Are Red-Black Trees Useful?

Efficient Operations

Search, insertion, and removal operations have a worst-case time complexity of O(log n).

Learn more about red-black trees on Wikipedia