Question: RBTNode is a Java class for a node in a red - black tree. Which is the correct implementation of the RBTNode class's areBothChildrenBlack (
RBTNode is a Java class for a node in a redblack tree. Which is the correct implementation of the
RBTNode class's areBothChildrenBlack method?
boolean areBothChildrenBlack
if leftisRed right.isRed
return false;
return true;
boolean areBothChildrenBlack
if leftisRed && right.isRed
return false;
return true;
boolean areBothChildrenBlack
if left null left.isRed
return false;
if right null right.isRed
return false;
return true;
boolean areBothChildrenBlack
if left null && left.isRed
return false;
if right null && right.isRed
return false;
return true;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
