problem: https://hack.codingblocks.com/app/contests/2022/925/problem
in this question I’m not able to understand how I will take the input, the way sir has taught doesn’t seem to work on this input
problem: https://hack.codingblocks.com/app/contests/2022/925/problem
in this question I’m not able to understand how I will take the input, the way sir has taught doesn’t seem to work on this input
void PrintLevel(node* root){
queue<node*> q;
q.push(root);
q.push(NULL);
while(!q.empty()){
node* x = q.front();
q.pop();
if(x == NULL){
cout<<endl;
if(!q.empty()){
q.push(NULL);
}
}
else{
cout<<x->data;
if(x->left != NULL){
q.push(x->left);
}
if(x->right != NULL){
q.push(x->right);
}
}
}
}
this way?
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.