Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This structure build a B-tree.
C++
struct node
{
    int data[2];
    node *left;
    node *middle;
    node *right;
    node();
}*first;
node::node
{
    data[0]=data[1]=-1;  //Values must be even
}
int main()
{
    first=NULL;
    .
    .
    .
    return 0;
}

please help me to create insert function
Posted
Updated 8-Jan-12 23:42pm
v2

1 solution

Well, we won't give you 'the code'. However we can give you some hints. For instance you may have a look ath the Wikipedia B-Tree page[^] where the insertion algorithm is explained (there's even a 'pictorial' description).
Please note, the code you wrote doesn't compile (you know the constructor, like other methods, needs a couple of braces, before its body).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900