Red-Ebony - Black height limit

I read the wiki about Red-Black Trees .

Can someone clarify the 5th restriction:

  • A node is either red or black.

  • The root is black.

  • All leaves (NIL) are black. (All leaves are the same color as the root.)

  • Both children from each red node are black.

  • Each simple path from a given node to any of its descendants leaves the same number of black nodes.

I am having difficulty understanding this, because given the state of the RBT example after the final insertion case (case 5 on the wiki) it gives us:

Wiki Red Black tree

Does 4 and 5 have another black node than 1,2 and 3?

+5
source share
3 answers

1, 2, 3, 4 5 - . , node 1, 2 3 . , - 1-5 , N, node ( 3).

1, 2 3 node (G , P ), 4 5 (G U , P U ). 1, 2 3 node, 4 5.

+5

, , , .

N node, , , insert P [1,3] [2,3] ( 2 1). P U ( 4,5 - ).

+1

-! , .

"talk" , " , . , , ".

-, , , ( ), node ( ).

, , , " 5". , .

+1

All Articles