Code to implement a BFS Traversal
Why is my code showing compilation error?
node* BuildTree()
{
int d; cin>>d;
if(d == -1 ) return NULL; // u forgot to add this line here
node* root= new node(d); // constructor call
root->left=BuildTree();
root->right=BuildTree();
return root; // remember to return root '_'
}
1 Like
Thanks so much