# Why is this not a valid Red-Black tree?

I'm having some difficulty understanding the rules for valid red-black tree. If my understanding is correct there are 4 rules that a tree has to follow to be a red-black tree.

1. Every node has a color either red or black.
2. Root of tree is always black.
3. There are no two adjacent red nodes (A red node cannot have a red parent or red child).
4. Every path from root to a NULL node has same number of black nodes.

So I drew the tree below in a quiz, and apparently it's not valid. Could someone tell me why this tree is invalid?

Thank you!

• This rules apply also in construction phase, during nodes insertion? Could you give more context how it was constructed or what was the actual question?
– Evil
Aug 15, 2016 at 20:24
• @Evil The question was: There are 8 internal nodes, Label each of them with a color (red,black) so that it's a legal red-black tree. Those nodes were empty and I filled them, no other information was given about how the tree constructed. Aug 15, 2016 at 20:26
• The answer seems to follow immediately as soon as you look at the example & picture in Wikipedia: en.wikipedia.org/wiki/Red%E2%80%93black_tree#Properties. A tip: when you're confused, it's good to look at existing resources first before asking (e.g., check Wikipedia, common textbooks), and tell us in the question what investigation you did.
– D.W.
Aug 15, 2016 at 22:41
• @D.W. Thanks exampled helped quite a lot! Aug 16, 2016 at 0:01
• Hint: Count the black nodes from root to leaves at each given path Aug 16, 2016 at 21:40