Learn Before
Concept icon
Concept

Red-Black Tree

A red-black tree is a self-balancing binary search tree where each node has a color attribute (red or black). This coloring scheme and a set of balancing rules ensure that the tree remains balanced, maintaining a search time complexity of O(logn)O(\log n).

Properties of a Red-Black Tree

A valid red-black tree must satisfy the following major rules:

  1. Every root node is black.
  2. All red nodes have black children.
  3. The path from the root to the end of the tree contains an equal number of black nodes.

0

1

Concept icon
Updated 2026-07-01

Tags

Python Programming Language

Data Science

Learn After