'How to paint binary tree in red-black
I have already created binary tree, and i have to paint every node in red or black to make red-black tree.
struct node {
string name;
int year;
int num;
node *right = NULL, *node = NULL;
string color;
node* parent = NULL;
};
class bTree {
node* root;
int avarage = 0;
int count = 0;
public:
node* getRoot() { return root; }
bTree() { root = NULL; };
void create(string Name, int Year, int Num);
void add(string Name, int Year, int Num);
void paint(node* temp);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|