What is a RedBlack Tree?
This lesson is an introduction to RedBlack trees, their properties, and the total time it takes to perform the operations of insertion, deletion, and searching.
We'll cover the following
Introduction
A RedBlack Tree is another type of selfbalancing Binary Search Tree, just like the AVL Trees , but with some additions. The nodes in a RedBlack Tree are colored to either red or black. Colored nodes help in rebalancing the tree after insertion or deletion. There are also some cases used to balance the RedBlack Trees. We will also go through the insertion and deletion operations of the RedBlack Tree.
Properties of RedBlack Trees

Every node has either Red or Black color.

The root is always colored black.

Two red nodes cannot be adjacent, i.e. no red parent can have a red child and vice versa.

Every path from the root to a leaf must contain the exact same number of blackcolored nodes.

Every null node is considered to be black in color.
From the perspective of implementation, our node class will contain a boolean variable in addition that will store the information about the color of a node.
Given below is the basic structure of a Node which will be used to build a RedBlack Tree.
Level up your interview prep. Join Educative to access 80+ handson prep courses.