sharat wrote:
> hi..
>
Why don't you provide constructor for the 'node'?
and please provide the line number from where you are getting the
error.
Try this one:
>
> class btree {
> struct node {
> char data;
> node *left;
> node *right;
node(char d = '\0',
node* ll = 0, node* rr = 0) : data(d),
left(ll), right(rr) {}
> } *root;
>
> char *arr;
> int *lc;
> int *rc;
>
> public:
> btree(char *a, int *l, int *r, int size);
> void insert(int index);
> static node* buildtree(char *a, int *l, int *r, int index);
> void display();
> static void inorder(node *sr);
> ~btree();
> static void del(node *sr);
>
> };
>
>
>
> node* btree::buildtree(const char *a, const int *l, const int *r, int index) {
if (index != -1)
> {
> node* temp = new node(*(a + index));
> temp->left = buildtree(a, l, r, *(l + index));
> temp->right = buildtree(a, l, r, *(r + index));
return temp;
> }
>
> return 0;
> }
Well I hope this will provide some help to you.
|