Wikipedia's Red-black tree states the last property of a Red-black tree:
Every path from a given node to any of its descendant NIL nodes contains the same number of black nodes. Some definitions: the number of black nodes from the root to a node is the node's black depth; the uniform number of black nodes in all paths from root to the leaves is called the black-height of the red–black tree
I'm not understanding this property. So, looking at this tree from the above Wikipedia article:
What is this field's value for the 8
tree, i.e. Root (13) -> 8
?
How about for 15
, i.e. Root (13) -> 7 -> 15
?
When providing an answer, please also explain the why of that number.
In red-black tree you know: that black-depth is permanent for every two child in the tree. For example:
8:
We have two children's $1$ and $11$ and for them we know that black-depth($1$) = black-depth($11$)=$2$.