Red-Black Trees

Self-Balancing Binary Search Trees

Overview

A Red-Black Tree is a type of self-balancing binary search tree that ensures the tree remains approximately balanced during insertions and deletions. This guarantees O(log n) time complexity for search, insert, and delete operations.

Key Properties

Diagram of a Red-Black Tree
Example of an invalid and a valid Red-Black Tree showing red and black nodes.

Learn more at Red–Black Tree — geeksforgeeks .