I have the following claim:
Prove or disprove: If a key in a red-black tree has exactly one child (which isn't null) then it is always red.
My attempt:
Disproof.
We will exhibit a counterexample:
This tree satisfies the conditions of being a red-black tree, since:
- The root is black.
- All leaves are black.
- There isn't any red key.
- In each path there is the same amount of black keys, in particular, we have three black keys in such paths.
However, we have two keys in level 1, which have one child and it is black.
$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \blacksquare$
Is this counterexample correct?