There is C++ class for red/black tree, that have method for console output for tree without any specific libraries. The program correctly outputs numbers with any number of digits.
This is a training example of a red/black tree. This may be necessary for those who study C++ and dynamic structures such as trees.
g++ main.cpp rbtree.cpp -o main && ./mainThe following functions are available for working with tree:
void Tree::insert(int value): inserts node with valuevalueto a tree and calls the fixup function.void Tree::erase(Node *node): erases the node with valuevaluefrom tree and calls the fixup function.Node* Tree::find(int value): returns a pointer to a node in the tree with the valuevalue.Node* Tree::max(): returns a pointer to a node in the tree with the maximal value.Node* Tree::min(): returns a pointer to a node in the tree with the minimal value.void Tree::print(bool show_null_leaves = false): outputs the tree to the console. It has optional parametershow_null_leavesthat is false by default, responsible for displaying null leaves.void clear(): erases all the nodes from the tree.
With null leaves:

