To answer the second part of the question about whether to print a node as red or black, this information is stored in each node.
In a typical binary search tree, each node contains a value, a left pointer and a right pointer (and possibly a parent pointer). In a red-black tree, each node contains all these things, plus an additional field indicating whether this node is red or black. Various tree operations, such as insertion or deletion, are responsible for permanently storing this color information.
You will never be given an unpainted tree and it will offer colors for nodes (with the possible exception of a homework assignment or exam).
Chris okasaki
source share