QuestionJune 2, 2025

When new node is added to a Red -Black tree, which property is checked to determine that a violation exists? The uncle node is black. The parent node is red. The uncle node is red. The parent node is black.

When new node is added to a Red -Black tree, which property is checked to determine that a violation exists? The uncle node is black. The parent node is red. The uncle node is red. The parent node is black.
When new node is added to a Red -Black tree, which property is checked to determine that a violation exists?
The uncle node is black.
The parent node is red.
The uncle node is red.
The parent node is black.

Solution
4.1(360 votes)

Answer

The parent node is red. Explanation 1. Identify Red-Black Tree Properties In a Red-Black tree, the key property that can be violated when a new node is added is that no two consecutive red nodes are allowed. This means if a newly inserted node's parent is red, it violates this property. 2. Determine Violation Condition The violation occurs specifically when the **parent node is red** because it may lead to two consecutive red nodes (the new node and its parent).

Explanation

1. Identify Red-Black Tree Properties<br /> In a Red-Black tree, the key property that can be violated when a new node is added is that no two consecutive red nodes are allowed. This means if a newly inserted node's parent is red, it violates this property.<br /><br />2. Determine Violation Condition<br /> The violation occurs specifically when the **parent node is red** because it may lead to two consecutive red nodes (the new node and its parent).
Click to rate: