Q. In a Red-Black tree, what property ensures that the tree remains approximately balanced?
A.
Every node is either red or black
B.
The root is always black
C.
Every red node must have two black children
D.
All leaves are black
Solution
In a Red-Black tree, every red node must have two black children, which helps maintain balance and ensures that no path from the root to a leaf is more than twice as long as any other such path.
Correct Answer:
C
— Every red node must have two black children
Q. What is a significant advantage of Red-Black trees over AVL trees?
A.
Faster search times
B.
Less strict balancing
C.
Easier implementation
D.
More memory usage
Solution
Red-Black trees are less strictly balanced than AVL trees, which can lead to faster insertion and deletion operations, making them more efficient in certain applications.