0

So in a binary tree the insertion looks something like this:

```
void btree::insert(int num)
{
if(root!=NULL)
{
insert(num, root);
}
else
{
root=new Node;
root->data=num;
root->left=NULL;
root->right=NULL;
}
}
void btree::insert(int num, Node *leaf)
{
if(num< leaf->data)
{
if(leaf->left!=NULL)
{
insert(num, leaf->left);
}
else
{
leaf->left=new Node;
leaf->left->data=num;
leaf->left->left=NULL;
leaf->left->right=NULL;
}
}
else if(num>=leaf->data)
{
if(leaf->right!=NULL)
insert(num, leaf->right);
else
{
leaf->right=new Node;
leaf->right->data=num;
leaf->right->left=NULL;
leaf->right->right=NULL;
}
}
}
```

But how would you insert for an n-ary tree?