Which of the following is NOT a property of Red-Black trees?
Practice Questions
Q1
Which of the following is NOT a property of Red-Black trees?
Every node is either red or black
The root is always black
All leaves are red
Every path from a node to its descendant leaves has the same number of black nodes
Questions & Step-by-Step Solutions
Which of the following is NOT a property of Red-Black trees?
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 Red-Black trees. They include: 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 NIL nodes must have the same number of black nodes.
Step 3: Identify the leaves of a Red-Black tree. The leaves are the NIL nodes, which are the endpoints of the tree.
Step 4: Check the color of the leaves. In Red-Black trees, all NIL nodes (leaves) are black.
Step 5: Conclude that the statement 'all leaves (NIL nodes) are black' is true, and therefore, it is NOT a property that is violated.