Question: In a Red-Black tree, what color is the root node?
Options:
Red
Black
Green
Blue
Correct Answer: Black
Solution:
The root of a Red-Black tree is always black to maintain the properties of the tree.
In a Red-Black tree, what color is the root node?
Practice Questions
Q1
In a Red-Black tree, what color is the root node?
Red
Black
Green
Blue
Questions & Step-by-Step Solutions
In a Red-Black tree, what color is the root node?
Step 1: Understand what a Red-Black tree is. It is a type of binary search tree that has specific properties regarding the color of its nodes.
Step 2: Know that each node in a Red-Black tree can be either red or black.
Step 3: Learn the properties of a Red-Black tree. One of the properties states that the root node must always be black.
Step 4: Conclude that since the root node must be black, the answer to the question is that the root node is always black.
Red-Black Tree Properties – A Red-Black tree is a balanced binary search tree with specific properties, including that the root must always be black.
Soulshift Feedback×
On a scale of 0–10, how likely are you to recommend
The Soulshift Academy?