0

Would someone be so kind as to help me with this insert. The function insert takes two numbers, num and num2. num is the number to insert in the tree and num2 is the number of children to the parent node where num is inserted. I am getting errors for root->children = NULL. Here is what I have.

this is my tree base:

```
struct node
{
node *parent;
vector <node*> children;
int item;
};
node* root;
```

And my insert function:

```
void Tree::insert(int num, int num2)
{
if(isEmpty())
{
root = new node;
root->children = NULL;
root->item = num;
}
else if(root->children == NULL)
{
root->children = num;
for(int i = 0;i<num2;i++)
{
children = root;
root->children = NULL;
}
}
else
root->children = num;
}
```