What is the special property of red-black trees and what root should always be?

Hằng Đoàn

New member
What is the special property of red-black trees and what root should always be?
A. a color which is either red or black and root should always be black color only
B. height of the tree
C. pointer to next node
D. a color which is either green or black
 
Answer: A
Explanation: An extra attribute which is a color red or black is used. root is black because if it is red then one of red-black tree property which states that number of black nodes from root to null nodes must be same, will be violated.
 

Tìm kiếm

Back
Top