TheFearful 0 Newbie Poster

I am trying to create a 2-3 tree using an insert function and I am stuck beyond this point. I am able to get the first node with the small and large value, but I do not know what do to from here. Any advice/tips?

#include <iostream>
using namespace std;

struct Node
{
    int small;
    int large;
    Node* left;
    Node* middle;
    Node* right;
};
void Insert(Node*& tree, int item);
void inorder(Node* root);

int main()
{
    Node* root = NULL;
    Insert(root, 50);
    Insert(root, 90);
    return 0;
}

void Insert(Node*& tree, int item)
{
    if(tree == NULL)
    {
        tree = new Node;
        tree ->right = NULL;
        tree ->middle = NULL;
        tree ->left = NULL;
        tree ->small = item;
        if(item > tree->small && tree !=NULL)
            return;
    }
    else if(item < tree->small)
        Insert(tree->left, item);
    else if(item > tree->small)
        tree->large = item;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.