Which of the following is NOT a property of a Red-Black tree?
Practice Questions
Q1
Which of the following is NOT a property of a Red-Black tree?
Every node is either red or black.
The root is always red.
Red nodes cannot have red children.
Every path from a node to its descendant leaves must have the same number of black nodes.
Questions & Step-by-Step Solutions
Which of the following is NOT a property of a Red-Black tree?
Step 1: Understand what a Red-Black tree is. It is a type of binary search tree with specific properties.
Step 2: Learn the properties of a Red-Black tree. There are five main properties.
Step 3: Identify the properties: 1) Each node is either red or black. 2) The root is always black. 3) Red nodes cannot have red children (no two reds in a row). 4) Every path from a node to its descendant leaves must have the same number of black nodes. 5) Every leaf (NIL node) is black.
Step 4: Focus on the question, which asks for a property that is NOT true for Red-Black trees.
Step 5: Recall that the root of a Red-Black tree must always be black, not red. This is a true property.
Step 6: Conclude that if the question asks for a property that is NOT true, it would be saying the root can be red, which is incorrect.